# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Description:
#   The MLIR "Multi-Level Intermediate Representation" Compiler Infrastructure

load(":tblgen.bzl", "gentbl_cc_library", "td_library")
load(":linalggen.bzl", "genlinalg")
load(
    ":build_defs.bzl",
    "cc_headers_only",
    "if_cuda_available",
    "mlir_c_api_cc_library",
)

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
    licenses = ["notice"],
)

exports_files([
    "LICENSE.TXT",
    "include/mlir/Dialect/LLVMIR/LLVMOps.td",
    "run_lit.sh",
    "utils/textmate/mlir.json",
])

filegroup(
    name = "c_headers",
    srcs = glob(["include/mlir-c/**/*"]),  # <== i.e. match the entire tree
)

filegroup(
    name = "ConversionPassDetail",
    srcs = [
        "include/mlir/Conversion/GPUToROCDL/Runtimes.h",
        "lib/Conversion/PassDetail.h",
    ],
)

exports_files(glob(["include/**/*.td"]))

[
    gentbl_cc_library(
        name = name + "IncGen",
        strip_include_prefix = "include",
        tbl_outs = [
            (
                ["-gen-op-interface-decls"],
                "include/mlir/IR/" + name + ".h.inc",
            ),
            (
                ["-gen-op-interface-defs"],
                "include/mlir/IR/" + name + ".cpp.inc",
            ),
        ],
        tblgen = ":mlir-tblgen",
        td_file = "include/mlir/IR/" + name + ".td",
        deps = [":OpBaseTdFiles"],
    )
    for name in [
        "OpAsmInterface",
        "RegionKindInterface",
        "SymbolInterfaces",
    ]
]

gentbl_cc_library(
    name = "TensorEncodingIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/IR/TensorEncInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/IR/TensorEncInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/TensorEncoding.td",
    deps = [":TensorOpsTdFiles"],
)

td_library(
    name = "SubElementInterfacesTdFiles",
    srcs = ["include/mlir/IR/SubElementInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "SubElementInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/IR/SubElementAttrInterfaces.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/IR/SubElementAttrInterfaces.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/IR/SubElementTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/IR/SubElementTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/SubElementInterfaces.td",
    deps = [":SubElementInterfacesTdFiles"],
)

td_library(
    name = "BuiltinDialectTdFiles",
    srcs = [
        "include/mlir/IR/BuiltinAttributeInterfaces.td",
        "include/mlir/IR/BuiltinAttributes.td",
        "include/mlir/IR/BuiltinDialect.td",
        "include/mlir/IR/BuiltinLocationAttributes.td",
        "include/mlir/IR/BuiltinOps.td",
        "include/mlir/IR/BuiltinTypeInterfaces.td",
        "include/mlir/IR/BuiltinTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":SubElementInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "BuiltinDialectIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/IR/BuiltinDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/IR/BuiltinDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinDialect.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/IR/BuiltinAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/IR/BuiltinAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinAttributes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinAttributeInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attr-interface-decls"],
            "include/mlir/IR/BuiltinAttributeInterfaces.h.inc",
        ),
        (
            ["--gen-attr-interface-defs"],
            "include/mlir/IR/BuiltinAttributeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinAttributeInterfaces.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinLocationAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/IR/BuiltinLocationAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/IR/BuiltinLocationAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinLocationAttributes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/IR/BuiltinOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/IR/BuiltinOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinOps.td",
    deps = [
        ":BuiltinDialectTdFiles",
        ":FunctionInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "BuiltinTypesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-typedef-decls"],
            "include/mlir/IR/BuiltinTypes.h.inc",
        ),
        (
            ["--gen-typedef-defs"],
            "include/mlir/IR/BuiltinTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinTypes.td",
    deps = [":BuiltinDialectTdFiles"],
)

gentbl_cc_library(
    name = "BuiltinTypeInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-type-interface-decls"],
            "include/mlir/IR/BuiltinTypeInterfaces.h.inc",
        ),
        (
            ["--gen-type-interface-defs"],
            "include/mlir/IR/BuiltinTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/BuiltinTypeInterfaces.td",
    deps = [
        ":BuiltinDialectTdFiles",
    ],
)

td_library(
    name = "FunctionInterfacesTdFiles",
    srcs = ["include/mlir/IR/FunctionInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "FunctionInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/IR/FunctionOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/IR/FunctionOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/IR/FunctionInterfaces.td",
    deps = [
        ":OpBaseTdFiles",
    ],
)

cc_library(
    name = "IR",
    srcs = glob([
        "lib/IR/*.cpp",
        "lib/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/IR/*.h",
    ]) + [
        "include/mlir/Interfaces/CallInterfaces.h",
        "include/mlir/Interfaces/CastInterfaces.h",
        "include/mlir/Interfaces/SideEffectInterfaces.h",
        "include/mlir/Interfaces/DataLayoutInterfaces.h",
        "include/mlir/Interfaces/DecodeAttributesInterfaces.h",
        "include/mlir/Interfaces/FoldInterfaces.h",
    ],
    includes = ["include"],
    deps = [
        ":BuiltinAttributeInterfacesIncGen",
        ":BuiltinAttributesIncGen",
        ":BuiltinDialectIncGen",
        ":BuiltinLocationAttributesIncGen",
        ":BuiltinOpsIncGen",
        ":BuiltinTypeInterfacesIncGen",
        ":BuiltinTypesIncGen",
        ":CallOpInterfacesIncGen",
        ":CastOpInterfacesIncGen",
        ":DataLayoutInterfacesIncGen",
        ":FunctionInterfacesIncGen",
        ":InferTypeOpInterfaceIncGen",
        ":OpAsmInterfaceIncGen",
        ":RegionKindInterfaceIncGen",
        ":SideEffectInterfacesIncGen",
        ":SubElementInterfacesIncGen",
        ":Support",
        ":SymbolInterfacesIncGen",
        ":TensorEncodingIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "Pass",
    srcs = glob([
        "lib/Pass/*.cpp",
        "lib/Pass/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Pass/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":Support",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIIR",
    srcs = [
        "lib/CAPI/Dialect/Func.cpp",
        "lib/CAPI/IR/AffineExpr.cpp",
        "lib/CAPI/IR/AffineMap.cpp",
        "lib/CAPI/IR/BuiltinAttributes.cpp",
        "lib/CAPI/IR/BuiltinTypes.cpp",
        "lib/CAPI/IR/Diagnostics.cpp",
        "lib/CAPI/IR/DialectHandle.cpp",
        "lib/CAPI/IR/IR.cpp",
        "lib/CAPI/IR/IntegerSet.cpp",
        "lib/CAPI/IR/Pass.cpp",
        "lib/CAPI/IR/Support.cpp",
    ],
    hdrs = [
        "include/mlir-c/AffineExpr.h",
        "include/mlir-c/AffineMap.h",
        "include/mlir-c/BuiltinAttributes.h",
        "include/mlir-c/BuiltinTypes.h",
        "include/mlir-c/Diagnostics.h",
        "include/mlir-c/Dialect/Func.h",
        "include/mlir-c/ExecutionEngine.h",
        "include/mlir-c/IR.h",
        "include/mlir-c/IntegerSet.h",
        "include/mlir-c/Interfaces.h",
        "include/mlir-c/Pass.h",
        "include/mlir-c/RegisterEverything.h",
        "include/mlir-c/Support.h",
        "include/mlir/CAPI/AffineExpr.h",
        "include/mlir/CAPI/AffineMap.h",
        "include/mlir/CAPI/Diagnostics.h",
        "include/mlir/CAPI/IR.h",
        "include/mlir/CAPI/IntegerSet.h",
        "include/mlir/CAPI/Pass.h",
        "include/mlir/CAPI/Registration.h",
        "include/mlir/CAPI/Support.h",
        "include/mlir/CAPI/Utils.h",
        "include/mlir/CAPI/Wrap.h",
    ],
    header_deps = [
        ":IR",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":InferTypeOpInterface",
        ":Parser",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIInterfaces",
    srcs = [
        "lib/CAPI/Interfaces/Interfaces.cpp",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIAsync",
    srcs = [
        "lib/CAPI/Dialect/Async.cpp",
        "lib/CAPI/Dialect/AsyncPasses.cpp",
    ],
    hdrs = ["include/mlir-c/Dialect/Async.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":AsyncPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":AsyncDialect",
        ":AsyncTransforms",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPILinalg",
    srcs = [
        "lib/CAPI/Dialect/Linalg.cpp",
        "lib/CAPI/Dialect/LinalgPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Linalg.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":LinalgPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":LinalgDialect",
        ":LinalgTransforms",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPILLVM",
    srcs = [
        "lib/CAPI/Dialect/LLVM.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/LLVM.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":LLVMDialect",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIGPU",
    srcs = [
        "lib/CAPI/Dialect/GPU.cpp",
        "lib/CAPI/Dialect/GPUPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/GPU.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":GPUPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":GPUTransforms",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPISparseTensor",
    srcs = [
        "lib/CAPI/Dialect/SparseTensor.cpp",
        "lib/CAPI/Dialect/SparseTensorPasses.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/SparseTensor.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":SparseTensorPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":Pass",
        ":SparseTensorDialect",
        ":SparseTensorTransforms",
        ":Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIQuant",
    srcs = [
        "lib/CAPI/Dialect/Quant.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/Quant.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":QuantOps",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIPDL",
    srcs = [
        "lib/CAPI/Dialect/PDL.cpp",
    ],
    hdrs = [
        "include/mlir-c/Dialect/PDL.h",
    ],
    header_deps = [
        ":CAPIIRHeaders",
    ],
    includes = ["include"],
    deps = [
        ":CAPIIR",
        ":PDLDialect",
        ":PDLOpsIncGen",
        ":PDLTypesIncGen",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIConversion",
    srcs = ["lib/CAPI/Conversion/Passes.cpp"],
    hdrs = ["include/mlir-c/Conversion.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":ConversionPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":ConversionPasses",
        ":Pass",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIDebug",
    srcs = ["lib/CAPI/Debug/Debug.cpp"],
    hdrs = ["include/mlir-c/Debug.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIExecutionEngine",
    srcs = ["lib/CAPI/ExecutionEngine/ExecutionEngine.cpp"],
    hdrs = [
        "include/mlir-c/ExecutionEngine.h",
        "include/mlir/CAPI/ExecutionEngine.h",
    ],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":ExecutionEngine",
    ],
    includes = ["include"],
    deps = [
        ":ExecutionEngineUtils",
        ":LLVMToLLVMIRTranslation",
        "//llvm:OrcJIT",
        "//llvm:Support",
    ],
)

mlir_c_api_cc_library(
    name = "CAPITransforms",
    srcs = ["lib/CAPI/Transforms/Passes.cpp"],
    hdrs = ["include/mlir-c/Transforms.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    header_deps = [
        ":TransformsPassIncGen",
    ],
    includes = ["include"],
    deps = [
        ":Pass",
        ":Transforms",
    ],
)

mlir_c_api_cc_library(
    name = "CAPIRegisterEverything",
    srcs = ["lib/CAPI/RegisterEverything/RegisterEverything.cpp"],
    hdrs = ["include/mlir-c/RegisterEverything.h"],
    capi_deps = [
        ":CAPIIR",
    ],
    includes = ["include"],
    deps = [
        ":AllPassesAndDialects",
        ":LLVMToLLVMIRTranslation",
    ],
)

##---------------------------------------------------------------------------##
# Sources of Python bindings.
#----------------------------------------------------------------------------##

exports_files(
    glob(["lib/Bindings/Python/**/*.cpp"]),
)

MLIR_BINDINGS_PYTHON_HEADERS = [
    "lib/Bindings/Python/*.h",
    "include/mlir-c/Bindings/Python/*.h",
    "include/mlir/Bindings/Python/*.h",
]

cc_library(
    name = "MLIRBindingsPythonHeaders",
    includes = [
        "include",
        "lib/Bindings/Python",
    ],
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS),
    deps = [
        ":CAPIIRHeaders",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

cc_library(
    name = "MLIRBindingsPythonHeadersAndDeps",
    includes = [
        "include",
        "lib/Bindings/Python",
    ],
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    textual_hdrs = glob(MLIR_BINDINGS_PYTHON_HEADERS),
    deps = [
        ":CAPIIR",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

# These flags are needed for pybind11 to work.
PYBIND11_COPTS = [
    "-fexceptions",
    "-frtti",
]

PYBIND11_FEATURES = [
    # Cannot use header_modules (parse_headers feature fails).
    "-use_header_modules",
]

MLIR_PYTHON_BINDINGS_SOURCES = [
    "lib/Bindings/Python/IRAffine.cpp",
    "lib/Bindings/Python/IRAttributes.cpp",
    "lib/Bindings/Python/IRCore.cpp",
    "lib/Bindings/Python/IRInterfaces.cpp",
    "lib/Bindings/Python/IRModule.cpp",
    "lib/Bindings/Python/IRTypes.cpp",
    "lib/Bindings/Python/Pass.cpp",
    "lib/Bindings/Python/PybindUtils.cpp",
]

cc_library(
    name = "MLIRBindingsPythonCore",
    srcs = MLIR_PYTHON_BINDINGS_SOURCES,
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIAsync",
        ":CAPIDebug",
        ":CAPIGPU",
        ":CAPIIR",
        ":CAPIInterfaces",
        ":MLIRBindingsPythonHeadersAndDeps",
        "//llvm:Support",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

cc_library(
    name = "MLIRBindingsPythonCoreNoCAPI",
    srcs = MLIR_PYTHON_BINDINGS_SOURCES,
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIAsyncHeaders",
        ":CAPIDebugHeaders",
        ":CAPIGPUHeaders",
        ":CAPIIRHeaders",
        ":MLIRBindingsPythonHeaders",
        "//llvm:Support",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

# Target that bundles together the CAPI objects needed for
# MLIRBindingsPythonCoreNoCAPI.
cc_library(
    name = "MLIRBindingsPythonCAPIObjects",
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIAsyncObjects",
        ":CAPIDebugObjects",
        ":CAPIGPUObjects",
        ":CAPIIRObjects",
        ":CAPIInterfacesObjects",
    ],
)

# Dynamic library with the MLIR Python extension.
cc_binary(
    name = "_mlir.so",
    srcs = ["lib/Bindings/Python/MainModule.cpp"],
    # These flags are needed for pybind11 to work.
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":MLIRBindingsPythonCore",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

cc_binary(
    name = "_mlirDialectsLinalg.so",
    srcs = ["lib/Bindings/Python/DialectLinalg.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIIR",
        ":CAPILinalg",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

cc_binary(
    name = "_mlirDialectsQuant.so",
    srcs = ["lib/Bindings/Python/DialectQuant.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIIR",
        ":CAPIQuant",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

cc_binary(
    name = "_mlirDialectsSparseTensor.so",
    srcs = ["lib/Bindings/Python/DialectSparseTensor.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIIR",
        ":CAPISparseTensor",
        ":MLIRBindingsPythonHeadersAndDeps",
    ],
)

# Dynamic library with the MLIR Conversions Python extension.
cc_binary(
    name = "_mlirExecutionEngine.so",
    srcs = ["lib/Bindings/Python/ExecutionEngineModule.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPIExecutionEngine",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

# Dynamic library with the MLIR Linalg dialect+passes Python extension.
cc_binary(
    name = "_mlirLinalgPasses.so",
    srcs = ["lib/Bindings/Python/LinalgPasses.cpp"],
    copts = PYBIND11_COPTS,
    features = PYBIND11_FEATURES,
    linkshared = 1,
    linkstatic = 0,
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":CAPILinalg",
        ":MLIRBindingsPythonHeadersAndDeps",
        "@pybind11",
        "@python_runtime//:headers",
    ],
)

##---------------------------------------------------------------------------##

td_library(
    name = "AttrTdFiles",
    srcs = [
        "include/mlir/IR/AttrTypeBase.td",
        "include/mlir/IR/EnumAttr.td",
    ],
    includes = ["include"],
)

td_library(
    name = "OpBaseTdFiles",
    srcs = [
        "include/mlir/IR/DialectBase.td",
        "include/mlir/IR/OpAsmInterface.td",
        "include/mlir/IR/OpBase.td",
        "include/mlir/IR/PatternBase.td",
        "include/mlir/IR/RegionKindInterface.td",
        "include/mlir/IR/SymbolInterfaces.td",
        "include/mlir/IR/TensorEncoding.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
    ],
)

td_library(
    name = "CallInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/CallInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "CastInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/CastInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ControlFlowInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/ControlFlowInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "CopyOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/CopyOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "DerivedAttributeOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "InferIntRangeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/InferIntRangeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "InferTypeOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/InferTypeOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "LoopLikeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/LoopLikeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ParallelCombiningOpInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "SideEffectInterfacesTdFiles",
    srcs = [
        "include/mlir/Interfaces/SideEffectInterfaceBase.td",
        "include/mlir/Interfaces/SideEffectInterfaces.td",
    ],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "TilingInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/TilingInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "VectorInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/VectorInterfaces.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ViewLikeInterfaceTdFiles",
    srcs = ["include/mlir/Interfaces/ViewLikeInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

td_library(
    name = "ReducerTdFiles",
    srcs = ["include/mlir/Reducer/Passes.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

##---------------------------------------------------------------------------##
# Affine dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "PassBaseTdFiles",
    srcs = ["include/mlir/Pass/PassBase.td"],
    includes = ["include"],
)

td_library(
    name = "RewritePassBaseTdFiles",
    srcs = ["include/mlir/Rewrite/PassUtil.td"],
    includes = ["include"],
)

td_library(
    name = "AffineOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td",
        "include/mlir/Dialect/Affine/IR/AffineOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticOpsTdFiles",
        ":FuncTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AffineOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Affine/IR/AffineOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=affine",
            ],
            "include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=affine",
            ],
            "include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/IR/AffineOps.td",
    deps = [":AffineOpsTdFiles"],
)

gentbl_cc_library(
    name = "AffineMemoryOpInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td",
    deps = [":AffineOpsTdFiles"],
)

##---------------------------------------------------------------------------##
# AMDGPU dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AMDGPUTdFiles",
    srcs = ["include/mlir/Dialect/AMDGPU/AMDGPU.td"],
    includes = ["include"],
    deps = [
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AMDGPUIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/AMDGPUDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=amdgpu",
            ],
            "include/mlir/Dialect/AMDGPU/AMDGPUDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/AMDGPU/AMDGPU.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/AMDGPU/AMDGPU.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMDGPU/AMDGPU.td",
    deps = [":AMDGPUTdFiles"],
)

cc_library(
    name = "AMDGPUDialect",
    srcs = ["lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp"],
    hdrs = ["include/mlir/Dialect/AMDGPU/AMDGPUDialect.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUIncGen",
        ":IR",
        ":SideEffectInterfaces",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# EmitC dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "EmitCTdFiles",
    srcs = [
        "include/mlir/Dialect/EmitC/IR/EmitC.td",
        "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td",
        "include/mlir/Dialect/EmitC/IR/EmitCBase.td",
        "include/mlir/Dialect/EmitC/IR/EmitCTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":CastInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "EmitCAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCAttributes.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td",
    deps = [":EmitCTdFiles"],
)

gentbl_cc_library(
    name = "EmitCOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitC.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitC.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/EmitC/IR/EmitCTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/EmitC/IR/EmitCTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/EmitC/IR/EmitC.td",
    deps = [":EmitCTdFiles"],
)

cc_library(
    name = "TargetCpp",
    srcs = glob([
        "lib/Target/Cpp/*.cpp",
        "lib/Target/Cpp/*.h",
    ]),
    hdrs = glob(["include/mlir/Target/Cpp/*.h"]),
    deps = [
        ":ArithmeticDialect",
        ":ControlFlowDialect",
        ":EmitCDialect",
        ":FuncDialect",
        ":IR",
        ":MathDialect",
        ":SCFDialect",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# Async dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AsyncOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Async/IR/AsyncDialect.td",
        "include/mlir/Dialect/Async/IR/AsyncOps.td",
        "include/mlir/Dialect/Async/IR/AsyncTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AsyncOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Async/IR/AsyncOps.td",
    deps = [":AsyncOpsTdFiles"],
)

gentbl_cc_library(
    name = "AsyncPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Async",
            ],
            "include/mlir/Dialect/Async/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Async",
            ],
            "include/mlir/Dialect/Async/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Async",
            ],
            "include/mlir/Dialect/Async/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Async/Passes.td",
    deps = [":PassBaseTdFiles"],
)

##---------------------------------------------------------------------------##
# ArmNeon dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "ArmNeonTdFiles",
    srcs = ["include/mlir/Dialect/ArmNeon/ArmNeon.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmNeonIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=arm_neon",
            ],
            "include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arm_neon",
            ],
            "include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmNeon/ArmNeon.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/ArmNeon/ArmNeon.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td",
    deps = [":ArmNeonTdFiles"],
)

cc_library(
    name = "ArmNeonDialect",
    srcs = ["lib/Dialect/ArmNeon/IR/ArmNeonDialect.cpp"],
    hdrs = ["include/mlir/Dialect/ArmNeon/ArmNeonDialect.h"],
    includes = ["include"],
    deps = [
        ":ArmNeonIncGen",
        ":IR",
        ":SideEffectInterfaces",
        ":VectorDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArmNeonConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td",
    deps = [":ArmNeonTdFiles"],
)

cc_library(
    name = "ArmNeon2dToIntr",
    srcs = glob([
        "lib/Conversion/ArmNeon2dToIntr/*.cpp",
        "lib/Conversion/ArmNeon2dToIntr/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/ArmNeon2dToIntr/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArmNeonDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":OpenACCDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        ":VectorDialect",
    ],
)

##---------------------------------------------------------------------------##
# ArmSVE dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "ArmSVETdFiles",
    srcs = [
        "include/mlir/Dialect/ArmSVE/ArmSVE.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticOpsTdFiles",
        ":FuncTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArmSVEIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ArmSVE/ArmSVE.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ArmSVE/ArmSVE.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/ArmSVE/ArmSVETypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/ArmSVE/ArmSVETypes.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=arm_sve",
            ],
            "include/mlir/Dialect/ArmSVE/ArmSVEDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arm_sve",
            ],
            "include/mlir/Dialect/ArmSVE/ArmSVEDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSVE/ArmSVE.td",
    deps = [":ArmSVETdFiles"],
)

cc_library(
    name = "ArmSVEDialect",
    srcs = ["lib/Dialect/ArmSVE/IR/ArmSVEDialect.cpp"],
    hdrs = ["include/mlir/Dialect/ArmSVE/ArmSVEDialect.h"],
    includes = ["include"],
    deps = [
        ":ArmSVEIncGen",
        ":IR",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSVETransforms",
    srcs = glob(["lib/Dialect/ArmSVE/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/ArmSVE/Transforms.h"],
    includes = ["include"],
    deps = [
        ":ArmSVEDialect",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":TransformUtils",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArmSVEConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/ArmSVE/ArmSVEConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ArmSVE/ArmSVE.td",
    deps = [":ArmSVETdFiles"],
)

##---------------------------------------------------------------------------##
# AMX dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "AMXTdFiles",
    srcs = ["include/mlir/Dialect/AMX/AMX.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "AMXIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=amx",
            ],
            "include/mlir/Dialect/AMX/AMXDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=amx",
            ],
            "include/mlir/Dialect/AMX/AMXDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/AMX/AMX.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/AMX/AMX.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/AMX/AMX.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMX/AMX.td",
    deps = [":AMXTdFiles"],
)

cc_library(
    name = "AMXDialect",
    srcs = ["lib/Dialect/AMX/IR/AMXDialect.cpp"],
    hdrs = ["include/mlir/Dialect/AMX/AMXDialect.h"],
    includes = ["include"],
    deps = [
        ":AMXIncGen",
        ":IR",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AMXTransforms",
    srcs = glob(["lib/Dialect/AMX/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/AMX/Transforms.h"],
    includes = ["include"],
    deps = [
        ":AMXDialect",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "AMXConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/AMX/AMXConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/AMX/AMX.td",
    deps = [":AMXTdFiles"],
)

##---------------------------------------------------------------------------##
# X86Vector dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "X86VectorTdFiles",
    srcs = ["include/mlir/Dialect/X86Vector/X86Vector.td"],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":LLVMOpsTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "X86VectorIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=x86vector",
            ],
            "include/mlir/Dialect/X86Vector/X86VectorDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=x86vector",
            ],
            "include/mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/X86Vector/X86Vector.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/X86Vector/X86Vector.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/X86Vector/X86Vector.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/X86Vector/X86Vector.td",
    deps = [":X86VectorTdFiles"],
)

cc_library(
    name = "X86VectorDialect",
    srcs = ["lib/Dialect/X86Vector/IR/X86VectorDialect.cpp"],
    hdrs = ["include/mlir/Dialect/X86Vector/X86VectorDialect.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        ":LLVMDialect",
        ":SideEffectInterfaces",
        ":X86VectorIncGen",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "X86VectorTransforms",
    srcs = glob(["lib/Dialect/X86Vector/Transforms/*.cpp"]),
    hdrs = ["include/mlir/Dialect/X86Vector/Transforms.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":VectorDialect",
        ":X86VectorDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "X86VectorConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/X86Vector/X86VectorConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/X86Vector/X86Vector.td",
    deps = [":X86VectorTdFiles"],
)

##---------------------------------------------------------------------------##
# SCF dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "SCFTdFiles",
    srcs = ["include/mlir/Dialect/SCF/IR/SCFOps.td"],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":ParallelCombiningOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "SCFIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SCF/IR/SCFOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SCF/IR/SCFOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/SCF/IR/SCFOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/SCF/IR/SCFOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/IR/SCFOps.td",
    deps = [":SCFTdFiles"],
)

gentbl_cc_library(
    name = "SCFPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SCF",
            ],
            "include/mlir/Dialect/SCF/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "SCFTransforms",
    srcs = glob([
        "lib/Dialect/SCF/Transforms/*.cpp",
        "lib/Dialect/SCF/Transforms/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SCF/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFPassIncGen",
        ":SCFUtils",
        ":Support",
        ":TensorDialect",
        ":TensorTransforms",
        ":TilingInterface",
        ":Transforms",
        "//llvm:Support",
    ],
)

td_library(
    name = "SCFTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":PDLDialect",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "SCFTransformOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td",
    deps = [
        ":SCFTransformOpsTdFiles",
    ],
)

cc_library(
    name = "SCFTransformOps",
    srcs = glob(["lib/Dialect/SCF/TransformOps/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/SCF/TransformOps/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":FuncDialect",
        ":IR",
        ":PDLDialect",
        ":SCFDialect",
        ":SCFTransformOpsIncGen",
        ":SCFTransforms",
        ":SCFUtils",
        ":SideEffectInterfaces",
        ":TransformDialect",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# SparseTensor dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "SparseTensorTdFiles",
    srcs = [
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td",
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorBase.td",
        "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "SparseTensorAttrDefsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td",
    deps = [":SparseTensorTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=sparse_tensor",
            ],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=sparse_tensor",
            ],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/SparseTensor/SparseTensor.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td",
    deps = [":SparseTensorTdFiles"],
)

gentbl_cc_library(
    name = "SparseTensorPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=SparseTensor",
            ],
            "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SparseTensor/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "SparseTensorDialect",
    srcs = ["lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp"],
    hdrs = ["include/mlir/Dialect/SparseTensor/IR/SparseTensor.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        ":SparseTensorAttrDefsIncGen",
        ":SparseTensorOpsIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorUtils",
    srcs = glob(["lib/Dialect/SparseTensor/Utils/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/SparseTensor/Utils/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ComplexDialect",
        ":IR",
        ":LinalgDialect",
        ":MathDialect",
        ":SparseTensorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorTransforms",
    srcs = glob([
        "lib/Dialect/SparseTensor/Transforms/*.cpp",
        "lib/Dialect/SparseTensor/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/SparseTensor/Transforms/Passes.h",
        "include/mlir/ExecutionEngine/SparseTensorUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":ComplexDialect",
        ":FuncDialect",
        ":FuncTransforms",
        ":IR",
        ":LLVMDialect",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":LinalgUtils",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFTransforms",
        ":SparseTensorDialect",
        ":SparseTensorPassIncGen",
        ":SparseTensorUtils",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        ":mlir_c_runner_utils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SparseTensorPipelines",
    srcs = glob(["lib/Dialect/SparseTensor/Pipelines/*.cpp"]),
    hdrs = ["include/mlir/Dialect/SparseTensor/Pipelines/Passes.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticTransforms",
        ":BufferizationTransforms",
        ":ConversionPasses",
        ":FuncDialect",
        ":FuncTransforms",
        ":LinalgTransforms",
        ":Pass",
        ":SparseTensorDialect",
        ":SparseTensorTransforms",
        ":TensorTransforms",
        ":VectorToLLVM",
        ":VectorTransforms",
    ],
)

##---------------------------------------------------------------------------##
# NVGPU dialect.
##---------------------------------------------------------------------------##

td_library(
    name = "NVGPUTdFiles",
    srcs = ["include/mlir/Dialect/NVGPU/IR/NVGPU.td"],
    includes = ["include"],
    deps = [
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "NVGPUIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=nvgpu",
            ],
            "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=nvgpu",
            ],
            "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/NVGPU/NVGPU.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/NVGPU/IR/NVGPU.td",
    deps = [":NVGPUTdFiles"],
)

gentbl_cc_library(
    name = "NVGPUPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=NVGPU",
            ],
            "include/mlir/Dialect/NVGPU/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/NVGPU/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "NVGPUDialect",
    srcs = ["lib/Dialect/NVGPU/IR/NVGPUDialect.cpp"],
    hdrs = ["include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h"],
    includes = ["include"],
    deps = [
        ":GPUDialect",
        ":IR",
        ":NVGPUIncGen",
        ":NVGPUPassIncGen",
        ":SideEffectInterfaces",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVGPUTransforms",
    srcs = [
        "lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp",
        "lib/Dialect/NVGPU/Transforms/PassDetail.h",
    ],
    hdrs = [
        "include/mlir/Dialect/NVGPU/Passes.h",
        "include/mlir/Dialect/NVGPU/Transforms/Transforms.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVGPUPassIncGen",
        ":Pass",
        ":SideEffectInterfaces",
        ":Support",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "FuncTdFiles",
    srcs = [
        "include/mlir/Dialect/Func/IR/FuncOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "FuncIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Func/IR/FuncOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Func/IR/FuncOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Func/IR/FuncOps.td",
    deps = [":FuncTdFiles"],
)

cc_library(
    name = "Dialect",
    srcs = glob([
        "lib/Dialect/*.cpp",
        "lib/Dialect/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "DialectUtils",
    srcs = glob([
        "lib/Dialect/Utils/*.cpp",
        "lib/Dialect/Utils/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineDialect",
    srcs = glob([
        "lib/Dialect/Affine/IR/*.cpp",
        "lib/Dialect/Affine/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Affine/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineMemoryOpInterfacesIncGen",
        ":AffineOpsIncGen",
        ":ArithmeticDialect",
        ":ControlFlowInterfaces",
        ":IR",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":SideEffectInterfaces",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "EmitCDialect",
    srcs = glob([
        "lib/Dialect/EmitC/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/EmitC/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":EmitCAttributesIncGen",
        ":EmitCOpsIncGen",
        ":IR",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AsyncDialect",
    srcs = glob([
        "lib/Dialect/Async/IR/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Async/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsyncOpsIncGen",
        ":ControlFlowInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AsyncTransforms",
    srcs = glob([
        "lib/Dialect/Async/Transforms/*.cpp",
        "lib/Dialect/Async/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Async/Passes.h",
        "include/mlir/Dialect/Async/Transforms.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticDialect",
        ":AsyncDialect",
        ":AsyncPassIncGen",
        ":ControlFlowDialect",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SCFDialect",
        ":SCFToControlFlow",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        ":TransformsPassIncGen",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineAnalysis",
    srcs = glob([
        "lib/Dialect/Affine/Analysis/*.cpp",
        "lib/Dialect/Affine/Analysis/*.h",
    ]),
    hdrs = glob(["include/mlir/Dialect/Affine/Analysis/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithmeticDialect",
        ":FuncDialect",
        ":IR",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineUtils",
    srcs = glob(
        [
            "lib/Dialect/Affine/Utils/*.cpp",
            "lib/Dialect/Affine/Utils/*.h",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Affine/LoopFusionUtils.h",
        "include/mlir/Dialect/Affine/LoopUtils.h",
        "include/mlir/Dialect/Affine/Utils.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":Analysis",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "AffinePassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Affine",
            ],
            "include/mlir/Dialect/Affine/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Affine/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "AffineTransforms",
    srcs = glob([
        "lib/Dialect/Affine/Transforms/*.cpp",
        "lib/Dialect/Affine/Transforms/*.h",
    ]),
    hdrs = ["include/mlir/Dialect/Affine/Passes.h"],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffinePassIncGen",
        ":AffineUtils",
        ":Analysis",
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFUtils",
        ":Support",
        ":Transforms",
        ":VectorDialect",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ConversionPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Conversion",
            ],
            "include/mlir/Conversion/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Conversion",
            ],
            "include/mlir/Conversion/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Conversion",
            ],
            "include/mlir/Conversion/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Conversion/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ConversionPasses",
    hdrs = ["include/mlir/Conversion/Passes.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUToROCDL",
        ":AffineToStandard",
        ":ArithmeticToLLVM",
        ":ArithmeticToSPIRV",
        ":ArmNeon2dToIntr",
        ":AsyncToLLVM",
        ":BufferizationToMemRef",
        ":ComplexToLLVM",
        ":ComplexToLibm",
        ":ComplexToStandard",
        ":ControlFlowToLLVM",
        ":ControlFlowToSPIRV",
        ":ConversionPassIncGen",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMTransforms",
        ":GPUToROCDLTransforms",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":LinalgToLLVM",
        ":LinalgToSPIRV",
        ":LinalgToStandard",
        ":MathToLLVM",
        ":MathToLibm",
        ":MathToSPIRV",
        ":MemRefToLLVM",
        ":MemRefToSPIRV",
        ":NVGPUToNVVM",
        ":OpenACCToLLVM",
        ":OpenACCToSCF",
        ":OpenMPToLLVM",
        ":PDLToPDLInterp",
        ":ReconcileUnrealizedCasts",
        ":SCFToControlFlow",
        ":SCFToGPU",
        ":SCFToOpenMP",
        ":SCFToSPIRV",
        ":SPIRVToLLVM",
        ":ShapeToStandard",
        ":TensorToLinalg",
        ":TensorToSPIRV",
        ":TosaToArith",
        ":TosaToLinalg",
        ":TosaToSCF",
        ":TosaToTensor",
        ":VectorToGPU",
        ":VectorToLLVM",
        ":VectorToSCF",
        ":VectorToSPIRV",
    ],
)

cc_library(
    name = "AsyncToLLVM",
    srcs = glob([
        "lib/Conversion/AsyncToLLVM/*.cpp",
        "lib/Conversion/AsyncToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/AsyncToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":AsyncDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AffineToStandard",
    srcs = glob([
        "lib/Conversion/AffineToStandard/*.cpp",
        "lib/Conversion/AffineToStandard/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/AffineToStandard/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        ":VectorDialect",
    ],
)

# SDBM dialect only contains attribute components that can be constructed given
# a dialect object, so whenever it is used it must also be registered. Therefore
# we don't split out the registration library for it.
cc_library(
    name = "SDBM",
    srcs = glob([
        "lib/Dialect/SDBM/*.cpp",
        "lib/Dialect/SDBM/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SDBM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFDialect",
    srcs = glob(
        [
            "lib/Dialect/SCF/IR/*.cpp",
            "lib/Dialect/SCF/IR/*.h",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Dialect/SCF/IR/*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":BufferizationDialect",
        ":ControlFlowDialect",
        ":ControlFlowInterfaces",
        ":FuncDialect",
        ":IR",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":ParallelCombiningOpInterface",
        ":Pass",
        ":SCFIncGen",
        ":SCFPassIncGen",
        ":Support",
        ":TensorDialect",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFUtils",
    srcs = glob(
        [
            "lib/Dialect/SCF/Utils/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Dialect/SCF/Utils/*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":Analysis",
        ":ArithmeticDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "DataLayoutInterfaces",
    srcs = ["lib/Interfaces/DataLayoutInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/DataLayoutInterfaces.h"],
    includes = ["include"],
    deps = [
        ":DataLayoutInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LoopLikeInterface",
    srcs = ["lib/Interfaces/LoopLikeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/LoopLikeInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":LoopLikeInterfaceIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ParallelCombiningOpInterface",
    srcs = ["lib/Interfaces/ParallelCombiningOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":ParallelCombiningOpInterfaceIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorInterfaces",
    srcs = ["lib/Interfaces/VectorInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/VectorInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":VectorInterfacesIncGen",
    ],
)

cc_library(
    name = "ViewLikeInterface",
    srcs = ["lib/Interfaces/ViewLikeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/ViewLikeInterface.h"],
    includes = ["include"],
    deps = [
        ":DialectUtils",
        ":IR",
        ":ViewLikeInterfaceIncGen",
    ],
)

cc_library(
    name = "CopyOpInterface",
    srcs = ["lib/Interfaces/CopyOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/CopyOpInterface.h"],
    includes = ["include"],
    deps = [
        ":CopyOpInterfaceIncGen",
        ":IR",
    ],
)

td_library(
    name = "ShapeOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Shape/IR/ShapeBase.td",
        "include/mlir/Dialect/Shape/IR/ShapeOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ShapeOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.cpp.inc",
        ),
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Shape/IR/ShapeOps.td",
    deps = [":ShapeOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLIRShapeCanonicalizationIncGen",
    strip_include_prefix = "include/mlir/Dialect/Shape/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "include/mlir/Dialect/Shape/IR/ShapeCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/Shape/IR/ShapeCanonicalization.td",
    deps = [
        ":FuncTdFiles",
        ":ShapeOpsTdFiles",
        ":TensorOpsTdFiles",
    ],
)

cc_library(
    name = "ShapeDialect",
    srcs = glob(["lib/Dialect/Shape/IR/*.cpp"]),
    hdrs = ["include/mlir/Dialect/Shape/IR/Shape.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ControlFlowInterfaces",
        ":Dialect",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":MLIRShapeCanonicalizationIncGen",
        ":ShapeOpsIncGen",
        ":SideEffectInterfaces",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ShapeToStandardGen",
    strip_include_prefix = "lib/Conversion/ShapeToStandard",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/ShapeToStandard/ShapeToStandard.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/ShapeToStandard/ShapeToStandard.td",
    deps = [":ShapeOpsTdFiles"],
)

cc_library(
    name = "ShapeToStandard",
    srcs = glob([
        "lib/Conversion/ShapeToStandard/*.cpp",
        "lib/Conversion/ShapeToStandard/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = ["include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":ShapeDialect",
        ":ShapeToStandardGen",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ShapeTransformsPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [(
        [
            "-gen-pass-decls",
            "-name=Shape",
        ],
        "include/mlir/Dialect/Shape/Transforms/Passes.h.inc",
    )],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Shape/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ShapeTransforms",
    srcs = glob([
        "lib/Dialect/Shape/Transforms/*.cpp",
        "lib/Dialect/Shape/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/Shape/Transforms/Passes.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":ShapeDialect",
        ":ShapeTransformsPassIncGen",
        ":Transforms",
    ],
)

td_library(
    name = "ControlFlowOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AttrTdFiles",
        ":CallInterfacesTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ControlFlowOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td",
    deps = [
        ":AttrTdFiles",
        ":ControlFlowOpsTdFiles",
    ],
)

cc_library(
    name = "ControlFlowDialect",
    srcs = glob(
        [
            "lib/Dialect/ControlFlow/IR/*.cpp",
            "lib/Dialect/ControlFlow/IR/*.h",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/ControlFlow/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":CommonFolders",
        ":ControlFlowInterfaces",
        ":ControlFlowOpsIncGen",
        ":IR",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FuncDialect",
    srcs = glob(
        [
            "lib/Dialect/Func/IR/*.cpp",
            "lib/Dialect/Func/IR/*.h",
            "lib/Dialect/Func/Utils/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Func/IR/*.h",
        "include/mlir/Dialect/Func/Utils/*.h",
    ]) + ["include/mlir/Transforms/InliningUtils.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":CallOpInterfaces",
        ":CastOpInterfaces",
        ":CommonFolders",
        ":ControlFlowDialect",
        ":ControlFlowInterfaces",
        ":FuncIncGen",
        ":IR",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
    ],
)

# TODO(zinenko): remove this after updating users.

gentbl_cc_library(
    name = "FuncTransformsPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [(
        [
            "-gen-pass-decls",
            "-name=Func",
        ],
        "include/mlir/Dialect/Func/Transforms/Passes.h.inc",
    )],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Func/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "FuncTransforms",
    srcs = glob([
        "lib/Dialect/Func/Transforms/*.cpp",
        "lib/Dialect/Func/Transforms/*.h",
    ]),
    hdrs = glob(["include/mlir/Dialect/Func/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":FuncTransformsPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorDialect",
    srcs = glob(
        [
            "lib/Dialect/Vector/IR/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":ControlFlowInterfaces",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":MemRefDialect",
        ":SideEffectInterfaces",
        ":Support",
        ":TensorDialect",
        ":VectorInterfaces",
        ":VectorOpsIncGen",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "VectorPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Vector",
            ],
            "include/mlir/Dialect/Vector/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "VectorTransforms",
    srcs = glob(
        [
            "lib/Dialect/Vector/Transforms/*.cpp",
            "lib/Dialect/Vector/Transforms/*.h",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        ":VectorInterfaces",
        ":VectorPassIncGen",
        ":VectorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorUtils",
    srcs = glob(
        [
            "lib/Dialect/Vector/Utils/*.cpp",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/Vector/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":ArithmeticDialect",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Support",
        ":TensorDialect",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "Support",
    srcs = glob([
        "lib/Support/*.cpp",
        "lib/Support/*.h",
    ]),
    hdrs = glob(["include/mlir/Support/*.h"]),
    includes = ["include"],
    deps = ["//llvm:Support"],
)

cc_library(
    name = "MlirLspServerSupportLib",
    srcs = glob(
        [
            "lib/Tools/lsp-server-support/*.cpp",
        ],
    ),
    hdrs = glob(
        [
            "lib/Tools/lsp-server-support/*.h",
        ],
    ),
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirLspServerLib",
    srcs = glob(
        [
            "lib/Tools/mlir-lsp-server/*.cpp",
            "lib/Tools/mlir-lsp-server/*.h",
            "lib/Tools/mlir-lsp-server/lsp/*.cpp",
            "lib/Tools/mlir-lsp-server/lsp/*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Tools/mlir-lsp-server/*.h"],
    ),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":IR",
        ":MlirLspServerSupportLib",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirPdllLspServerLib",
    srcs = glob(
        [
            "lib/Tools/mlir-pdll-lsp-server/*.cpp",
            "lib/Tools/mlir-pdll-lsp-server/*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Tools/mlir-pdll-lsp-server/*.h"],
    ),
    includes = ["include"],
    deps = [
        ":IR",
        ":MlirLspServerSupportLib",
        ":PDLLAST",
        ":PDLLCodeGen",
        ":PDLLODS",
        ":PDLLParser",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AsmParserTokenKinds",
    # strip_include_prefix does not apply to textual_hdrs.
    hdrs = ["lib/AsmParser/TokenKinds.def"],
    strip_include_prefix = "lib/AsmParser",
    textual_hdrs = ["lib/AsmParser/TokenKinds.def"],
)

cc_library(
    name = "AsmParser",
    srcs = glob([
        "lib/AsmParser/*.cpp",
        "lib/AsmParser/*.h",
    ]),
    hdrs = glob([
        "include/mlir/AsmParser/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsmParserTokenKinds",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "Parser",
    srcs = glob([
        "lib/Parser/*.cpp",
        "lib/Parser/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Parser/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":IR",
        ":Support",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMDialectInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMDialectAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["--gen-attrdef-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc",
        ),
        (
            ["--gen-attrdef-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td",
    deps = [":LLVMOpsTdFiles"],
)

cc_library(
    name = "LLVMDialect",
    srcs = glob(
        [
            "lib/Dialect/LLVMIR/IR/*.cpp",
            "lib/Dialect/LLVMIR/IR/*.h",
        ],
        exclude = [
            "lib/Dialect/LLVMIR/IR/*AMX*.cpp",
            "lib/Dialect/LLVMIR/IR/*AMX*.h",
            "lib/Dialect/LLVMIR/IR/*ArmSVE*.cpp",
            "lib/Dialect/LLVMIR/IR/*ArmSVE*.h",
            "lib/Dialect/LLVMIR/IR/NVVM*.cpp",
            "lib/Dialect/LLVMIR/IR/NVVM*.h",
            "lib/Dialect/LLVMIR/IR/ROCDL*.cpp",
            "lib/Dialect/LLVMIR/IR/ROCDL*.h",
            "lib/Dialect/LLVMIR/IR/*X86Vector*.cpp",
            "lib/Dialect/LLVMIR/IR/*X86Vector*.h",
        ],
    ),
    hdrs = glob(
        ["include/mlir/Dialect/LLVMIR/*.h"],
        exclude = [
            "include/mlir/Dialect/LLVMIR/*AMX*.h",
            "include/mlir/Dialect/LLVMIR/*ArmSVE*.h",
            "include/mlir/Dialect/LLVMIR/NVVM*.h",
            "include/mlir/Dialect/LLVMIR/ROCDL*.h",
            "include/mlir/Dialect/LLVMIR/*X86Vector*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":DataLayoutInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":LLVMDialectAttributesIncGen",
        ":LLVMDialectInterfaceIncGen",
        ":LLVMIntrinsicOpsIncGen",
        ":LLVMOpsIncGen",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:AsmParser",
        "//llvm:BitReader",
        "//llvm:BitWriter",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=LLVM",
            ],
            "include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "LLVMIRTransforms",
    srcs = glob([
        "lib/Dialect/LLVMIR/Transforms/*.cpp",
        "lib/Dialect/LLVMIR/Transforms/*.h",
    ]),
    hdrs = glob(["include/mlir/Dialect/LLVMIR/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":LLVMPassIncGen",
        ":NVVMDialect",
        ":Pass",
        ":Transforms",
    ],
)

td_library(
    name = "GPUOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/GPU/IR/GPUBase.td",
        "include/mlir/Dialect/GPU/IR/GPUOps.td",
        "include/mlir/Dialect/GPU/IR/ParallelLoopMapperAttr.td",
    ],
    includes = ["include"],
    deps = [
        ":DLTIDialectTdFiles",
        ":DataLayoutInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferIntRangeInterfaceTdFiles",
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "GPUBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/GPUBase.td",
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "GPUOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=gpu",
            ],
            "include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=gpu",
            ],
            "include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/IR/GPUOps.td",
    deps = [
        ":DLTIDialectTdFiles",
        ":GPUOpsTdFiles",
    ],
)

cc_library(
    name = "GPUDialect",
    srcs = glob(
        [
            "lib/Dialect/GPU/IR/*.cpp",
            "lib/Dialect/GPU/IR/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/GPU/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":DLTIDialect",
        ":GPUBaseIncGen",
        ":GPUOpsIncGen",
        ":IR",
        ":InferIntRangeInterface",
        ":InferTypeOpInterface",
        ":LLVMDialect",
        ":MemRefDialect",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "GPUPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=GPU",
            ],
            "include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/GPU/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "GPUTransforms",
    srcs = glob(
        [
            "lib/Dialect/GPU/Transforms/*.cpp",
            "lib/Dialect/GPU/Transforms/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/GPU/Transforms/*.h"]),
    defines = if_cuda_available(["MLIR_GPU_TO_CUBIN_PASS_ENABLE"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":AsmParser",
        ":AsyncDialect",
        ":ControlFlowDialect",
        ":DLTIDialect",
        ":AffineUtils",
        ":GPUDialect",
        ":GPUPassIncGen",
        ":MemRefDialect",
        ":IR",
        ":Pass",
        ":ROCDLToLLVMIRTranslation",
        ":SCFDialect",
        ":FuncDialect",
        ":Support",
        ":Transforms",
        ":ToLLVMIRTranslation",
        ":LLVMToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:MC",
        "//llvm:Support",
        "//llvm:Target",
    ] + if_cuda_available([
        # Dependencies for SerializeToCubin.cpp with
        # -DMLIR_GPU_TO_CUBIN_PASS_ENABLE
        ":NVVMToLLVMIRTranslation",
        "//llvm:NVPTXCodeGen",
        "@cuda//:cuda_headers",
        "@cuda//:libcuda",
    ]),
)

td_library(
    name = "LLVMOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
        "include/mlir/Dialect/LLVMIR/LLVMOpBase.td",
        "include/mlir/Dialect/LLVMIR/LLVMOps.td",
        "include/mlir/Dialect/LLVMIR/LLVMOpsInterfaces.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

cc_library(
    name = "GPUCommonTransforms",
    srcs = [
        "lib/Conversion/GPUCommon/GPUOpsLowering.cpp",
    ],
    hdrs = [
        "lib/Conversion/GPUCommon/GPUOpsLowering.h",
        "lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h",
        "lib/Conversion/GPUCommon/OpToFuncCallLowering.h",
    ],
    deps = [
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "GPUToNVVMGen",
    strip_include_prefix = "lib/Conversion/GPUToNVVM",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/GPUToNVVM/GPUToNVVM.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/GPUToNVVM/GPUToNVVM.td",
    deps = [
        ":GPUOpsTdFiles",
        ":NVVMOpsTdFiles",
    ],
)

cc_library(
    name = "GPUToNVVMTransforms",
    srcs = glob([
        "lib/Conversion/GPUToNVVM/*.cpp",
        "lib/Conversion/GPUToNVVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/GPUToNVVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ArithmeticToLLVM",
        ":ControlFlowDialect",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUCommonTransforms",
        ":GPUDialect",
        ":GPUToNVVMGen",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":NVVMDialect",
        ":Pass",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AMDGPUToROCDL",
    srcs = glob([
        "lib/Conversion/AMDGPUToROCDL/*.cpp",
        "lib/Conversion/AMDGPUToROCDL/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/AMDGPUToROCDL/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AMDGPUDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMCommonConversion",
        ":Pass",
        ":ROCDLDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVGPUToNVVM",
    srcs = glob([
        "lib/Conversion/NVGPUToNVVM/*.cpp",
        "lib/Conversion/NVGPUToNVVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/NVGPUToNVVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":NVGPUDialect",
        ":NVVMDialect",
        ":Pass",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToSPIRV",
    srcs = glob([
        "lib/Conversion/VectorToSPIRV/*.cpp",
        "lib/Conversion/VectorToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/VectorToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "GPUToROCDLTGen",
    strip_include_prefix = "lib/Conversion/GPUToROCDL",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Conversion/GPUToROCDL/GPUToROCDL.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Conversion/GPUToROCDL/GPUToROCDL.td",
    deps = [
        ":GPUOpsTdFiles",
        ":ROCDLOpsTdFiles",
    ],
)

cc_library(
    name = "GPUToROCDLTransforms",
    srcs = [
        "lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = ["include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h"],
    includes = ["include"],
    deps = [
        ":AMDGPUToROCDL",
        ":ArithmeticToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUCommonTransforms",
        ":GPUDialect",
        ":GPUToROCDLTGen",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":MathDialect",
        ":MemRefToLLVM",
        ":Pass",
        ":ROCDLDialect",
        ":Transforms",
        ":VectorDialect",
        ":VectorToLLVM",
        ":VectorToSCF",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToVulkanTransforms",
    srcs = [
        "lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp",
        "lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = ["include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"],
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":Pass",
        ":SPIRVDialect",
        ":SPIRVSerialization",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToGPURuntimeTransforms",
    srcs = [
        "lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = ["include/mlir/Conversion/GPUCommon/GPUCommonPass.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticToLLVM",
        ":AsyncDialect",
        ":AsyncToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncToLLVM",
        ":GPUDialect",
        ":GPUTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefToLLVM",
        ":NVVMToLLVMIRTranslation",
        ":Pass",
        ":Support",
        ":VectorToLLVM",
        "//llvm:Support",
    ],
)

cc_library(
    name = "GPUToSPIRV",
    srcs = glob([
        "lib/Conversion/GPUToSPIRV/*.cpp",
        "lib/Conversion/GPUToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/GPUToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversions/GPUToSPIRV",
    ],
    deps = [
        ":ArithmeticToSPIRV",
        ":ConversionPassIncGen",
        ":FuncToSPIRV",
        ":GPUDialect",
        ":IR",
        ":MemRefToSPIRV",
        ":Pass",
        ":SCFDialect",
        ":SCFToSPIRV",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":Transforms",
        ":VectorToSPIRV",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLToPDLInterp",
    srcs = glob([
        "lib/Conversion/PDLToPDLInterp/*.cpp",
        "lib/Conversion/PDLToPDLInterp/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = ["include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h"],
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":InferTypeOpInterface",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVToLLVM",
    srcs = glob([
        "lib/Conversion/SPIRVToLLVM/*.cpp",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/SPIRVToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefToLLVM",
        ":Pass",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LLVMOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMIntrinsicOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversions.inc",
        ),
        (
            ["-gen-enum-to-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc",
        ),
        (
            ["-gen-enum-from-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td",
    deps = [":LLVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "LLVMIntrinsicConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc",
        ),
        (
            ["-gen-llvmintrinsic-to-llvmirop-pairs"],
            "include/mlir/Dialect/LLVMIR/LLVMIntrinsicToLLVMIROpPairs.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td",
    deps = [":LLVMOpsTdFiles"],
)

cc_library(
    name = "NVVMDialect",
    srcs = ["lib/Dialect/LLVMIR/IR/NVVMDialect.cpp"],
    hdrs = ["include/mlir/Dialect/LLVMIR/NVVMDialect.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMDialect",
        ":NVVMOpsIncGen",
        ":SideEffectInterfaces",
        "//llvm:AsmParser",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "NVVMOpsTdFiles",
    srcs = ["include/mlir/Dialect/LLVMIR/NVVMOps.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "NVVMOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/NVVMOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=nvvm",
            ],
            "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

gentbl_cc_library(
    name = "NVVMConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/NVVMConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td",
    deps = [":NVVMOpsTdFiles"],
)

cc_library(
    name = "ROCDLDialect",
    srcs = ["lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp"],
    hdrs = ["include/mlir/Dialect/LLVMIR/ROCDLDialect.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMDialect",
        ":ROCDLOpsIncGen",
        ":SideEffectInterfaces",
        "//llvm:AsmParser",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "ROCDLOpsTdFiles",
    srcs = ["include/mlir/Dialect/LLVMIR/ROCDLOps.td"],
    includes = ["include"],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ROCDLOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=rocdl",
            ],
            "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td",
    deps = [":ROCDLOpsTdFiles"],
)

gentbl_cc_library(
    name = "ROCDLConversionIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-llvmir-conversions"],
            "include/mlir/Dialect/LLVMIR/ROCDLConversions.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td",
    deps = [":ROCDLOpsTdFiles"],
)

cc_library(
    name = "PDLDialect",
    srcs = glob([
        "lib/Dialect/PDL/IR/*.cpp",
        "lib/Dialect/PDL/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/PDL/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        ":PDLOpsIncGen",
        ":PDLTypesIncGen",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

td_library(
    name = "PDLDialectTdFiles",
    srcs = [
        "include/mlir/Dialect/PDL/IR/PDLDialect.td",
        "include/mlir/Dialect/PDL/IR/PDLOps.td",
        "include/mlir/Dialect/PDL/IR/PDLTypes.td",
    ],
    deps = [
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "PDLOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDL/IR/PDLOps.td",
    deps = [":PDLDialectTdFiles"],
)

gentbl_cc_library(
    name = "PDLTypesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDL/IR/PDLTypes.td",
    deps = [":PDLDialectTdFiles"],
)

cc_library(
    name = "PDLInterpDialect",
    srcs = glob([
        "lib/Dialect/PDLInterp/IR/*.cpp",
        "lib/Dialect/PDLInterp/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/PDLInterp/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterface",
        ":PDLDialect",
        ":PDLInterpOpsIncGen",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

td_library(
    name = "PDLInterpOpsTdFiles",
    srcs = ["include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td"],
    includes = ["include"],
    deps = [
        ":FunctionInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":PDLDialectTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "PDLInterpOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=pdl_interp",
            ],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=pdl_interp",
            ],
            "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td",
    deps = [":PDLInterpOpsTdFiles"],
)

td_library(
    name = "SPIRVOpsTdFiles",
    srcs = glob(["include/mlir/Dialect/SPIRV/IR/*.td"]),
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "SPIRVOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/SPIRV/SPIRVOps.md",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.cpp.inc",
        ),
        (
            ["-gen-spirv-enum-avail-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.h.inc",
        ),
        (
            ["-gen-spirv-enum-avail-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.cpp.inc",
        ),
        (
            ["-gen-spirv-capability-implication"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVCapabilityImplication.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVCanonicalizationIncGen",
    strip_include_prefix = "lib/Dialect/SPIRV/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAvailabilityIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-avail-interface-decls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc",
        ),
        (
            ["-gen-avail-interface-defs"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.cpp.inc",
        ),
        (
            ["-gen-spirv-avail-impls"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVOpAvailabilityImpl.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVAttrUtilsGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-spirv-attr-utils"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVAttrUtils.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVBase.td",
    deps = [":SPIRVOpsTdFiles"],
)

gentbl_cc_library(
    name = "SPIRVSerializationGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-spirv-serialization"],
            "include/mlir/Dialect/SPIRV/IR/SPIRVSerialization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td",
    deps = [":SPIRVOpsTdFiles"],
)

cc_library(
    name = "SPIRVDialect",
    srcs = glob([
        "lib/Dialect/SPIRV/IR/*.cpp",
        "lib/Dialect/SPIRV/IR/*.h",
    ]) + ["include/mlir/Transforms/InliningUtils.h"],
    hdrs = glob([
        "include/mlir/Dialect/SPIRV/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":CommonFolders",
        ":ControlFlowInterfaces",
        ":IR",
        ":InferTypeOpInterface",
        ":Parser",
        ":SPIRVAttrUtilsGen",
        ":SPIRVAttributesIncGen",
        ":SPIRVAvailabilityIncGen",
        ":SPIRVCanonicalizationIncGen",
        ":SPIRVOpsIncGen",
        ":SPIRVSerializationGen",
        ":SideEffectInterfaces",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "SPIRVPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=SPIRV",
            ],
            "include/mlir/Dialect/SPIRV/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/SPIRV/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "SPIRVUtils",
    srcs = glob([
        "lib/Dialect/SPIRV/Utils/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/SPIRV/Utils/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":SPIRVDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVConversion",
    srcs = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"],
    hdrs = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"],
    includes = ["include"],
    deps = [
        ":FuncDialect",
        ":SPIRVDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVTransforms",
    srcs = glob(
        [
            "lib/Dialect/SPIRV/Transforms/*.cpp",
            "lib/Dialect/SPIRV/Transforms/*.h",
        ],
        exclude = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"],
    ),
    hdrs = glob(
        ["include/mlir/Dialect/SPIRV/Transforms/*.h"],
        exclude = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"],
    ),
    includes = ["include"],
    deps = [
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVPassIncGen",
        ":SPIRVUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVCommonConversion",
    hdrs = ["lib/Conversion/SPIRVCommon/Pattern.h"],
    includes = ["include"],
    deps = [
        ":SPIRVDialect",
        ":Transforms",
    ],
)

cc_library(
    name = "MathToSPIRV",
    srcs = glob([
        "lib/Conversion/MathToSPIRV/*.cpp",
        "lib/Conversion/MathToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/MathToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/MathToSPIRV",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":MathDialect",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FuncToSPIRV",
    srcs = glob([
        "lib/Conversion/FuncToSPIRV/*.cpp",
        "lib/Conversion/FuncToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/FuncToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/FuncToSPIRV",
    ],
    deps = [
        ":ControlFlowToSPIRV",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MathToSPIRV",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorToLinalg",
    srcs = glob([
        "lib/Conversion/TensorToLinalg/*.cpp",
        "lib/Conversion/TensorToLinalg/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TensorToLinalg/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TensorToLinalg",
    ],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":Pass",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorToSPIRV",
    srcs = glob([
        "lib/Conversion/TensorToSPIRV/*.cpp",
        "lib/Conversion/TensorToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TensorToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TensorToSPIRV",
    ],
    deps = [
        ":ArithmeticToSPIRV",
        ":ControlFlowToSPIRV",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToSPIRV",
        ":IR",
        ":MathToSPIRV",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVBinaryUtils",
    srcs = ["lib/Target/SPIRV/SPIRVBinaryUtils.cpp"],
    hdrs = ["include/mlir/Target/SPIRV/SPIRVBinaryUtils.h"],
    includes = ["include"],
    deps = [
        ":SPIRVAttrUtilsGen",
        ":SPIRVDialect",
        ":SPIRVOpsIncGen",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVSerialization",
    srcs = [
        "lib/Target/SPIRV/Serialization/Serialization.cpp",
        "lib/Target/SPIRV/Serialization/SerializeOps.cpp",
        "lib/Target/SPIRV/Serialization/Serializer.cpp",
        "lib/Target/SPIRV/Serialization/Serializer.h",
    ],
    hdrs = ["include/mlir/Target/SPIRV/Serialization.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVAttrUtilsGen",
        ":SPIRVBinaryUtils",
        ":SPIRVDialect",
        ":SPIRVOpsIncGen",
        ":SPIRVSerializationGen",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVDeserialization",
    srcs = glob([
        "lib/Target/SPIRV/Deserialization/*.cpp",
        "lib/Target/SPIRV/Deserialization/*.h",
    ]),
    hdrs = ["include/mlir/Target/SPIRV/Deserialization.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVAttrUtilsGen",
        ":SPIRVBinaryUtils",
        ":SPIRVDialect",
        ":SPIRVOpsIncGen",
        ":SPIRVSerializationGen",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVModuleCombiner",
    srcs = glob(
        ["lib/Dialect/SPIRV/Linking/ModuleCombiner/*.cpp"],
    ),
    hdrs = ["include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SPIRVDialect",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SPIRVTranslateRegistration",
    srcs = ["lib/Target/SPIRV/TranslateRegistration.cpp"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":SPIRVDeserialization",
        ":SPIRVDialect",
        ":SPIRVSerialization",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
    ],
)

td_library(
    name = "TensorOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Tensor/IR/TensorBase.td",
        "include/mlir/Dialect/Tensor/IR/TensorOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":ParallelCombiningOpInterfaceTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":TilingInterfaceTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "TensorOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=tensor",
            ],
            "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=tensor",
            ],
            "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Tensor/IR/TensorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Tensor/IR/TensorOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tensor/IR/TensorOps.td",
    deps = [":TensorOpsTdFiles"],
)

cc_library(
    name = "TensorDialect",
    srcs = [
        "include/mlir/Transforms/InliningUtils.h",
        "lib/Dialect/Tensor/IR/TensorDialect.cpp",
        "lib/Dialect/Tensor/IR/TensorOps.cpp",
    ],
    hdrs = ["include/mlir/Dialect/Tensor/IR/Tensor.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":CastOpInterfaces",
        ":ComplexDialect",
        ":ControlFlowInterfaces",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":ParallelCombiningOpInterface",
        ":SideEffectInterfaces",
        ":TensorOpsIncGen",
        ":TilingInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorInferTypeOpInterfaceImpl",
    srcs = ["lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorTilingInterfaceImpl",
    srcs = ["lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticUtils",
        ":IR",
        ":LinalgDialect",
        ":SCFDialect",
        ":TensorDialect",
        ":TilingInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TensorUtils",
    srcs = ["lib/Dialect/Tensor/Utils/Utils.cpp"],
    hdrs = ["include/mlir/Dialect/Tensor/Utils/Utils.h"],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "TensorPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Tensor",
            ],
            "include/mlir/Dialect/Tensor/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tensor/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "TensorTransforms",
    srcs = glob(
        [
            "lib/Dialect/Tensor/Transforms/*.cpp",
            "lib/Dialect/Tensor/Transforms/*.h",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/Tensor/Transforms/Passes.h",
        "include/mlir/Dialect/Tensor/Transforms/Transforms.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorPassIncGen",
        ":TilingInterface",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "Rewrite",
    srcs = glob([
        "lib/Rewrite/*.cpp",
        "lib/Rewrite/*.h",
    ]),
    hdrs = glob(["include/mlir/Rewrite/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":IR",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":PDLToPDLInterp",
        ":Pass",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TransformUtils",
    srcs = glob([
        "lib/Transforms/Utils/*.cpp",
        "lib/Transforms/Utils/*.h",
    ]),
    hdrs = glob(
        [
            "include/mlir/Transforms/*.h",
        ],
        exclude = ["include/mlir/Transforms/Passes.h"],
    ),
    includes = ["include"],
    deps = [
        ":ControlFlowInterfaces",
        ":IR",
        ":LoopLikeInterface",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformsPassIncGen",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "DerivedAttributeOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/DerivedAttributeOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/DerivedAttributeOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/DerivedAttributeOpInterface.td",
    deps = [":DerivedAttributeOpInterfaceTdFiles"],
)

cc_library(
    name = "DerivedAttributeOpInterface",
    srcs = ["lib/Interfaces/DerivedAttributeOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.h"],
    includes = ["include"],
    deps = [
        ":DerivedAttributeOpInterfaceIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "InferIntRangeInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/InferIntRangeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/InferIntRangeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/InferIntRangeInterface.td",
    deps = [":InferIntRangeInterfaceTdFiles"],
)

cc_library(
    name = "InferIntRangeInterface",
    srcs = ["lib/Interfaces/InferIntRangeInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/InferIntRangeInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferIntRangeInterfaceIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "DataLayoutInterfacesTdFiles",
    srcs = ["include/mlir/Interfaces/DataLayoutInterfaces.td"],
    includes = ["include"],
)

gentbl_cc_library(
    name = "DataLayoutInterfacesIncGen",
    tbl_outs = [
        (
            ["-gen-attr-interface-decls"],
            "include/mlir/Interfaces/DataLayoutAttrInterface.h.inc",
        ),
        (
            ["-gen-attr-interface-defs"],
            "include/mlir/Interfaces/DataLayoutAttrInterface.cpp.inc",
        ),
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/DataLayoutOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/DataLayoutOpInterface.cpp.inc",
        ),
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Interfaces/DataLayoutTypeInterface.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Interfaces/DataLayoutTypeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/DataLayoutInterfaces.td",
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "LoopLikeInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/LoopLikeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/LoopLikeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/LoopLikeInterface.td",
    deps = [":LoopLikeInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "ParallelCombiningOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ParallelCombiningOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ParallelCombiningOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ParallelCombiningOpInterface.td",
    deps = [":ParallelCombiningOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "VectorInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/VectorInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/VectorInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/VectorInterfaces.td",
    deps = [":VectorInterfacesTdFiles"],
)

gentbl_cc_library(
    name = "ViewLikeInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ViewLikeInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ViewLikeInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ViewLikeInterface.td",
    deps = [":ViewLikeInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "CopyOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CopyOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CopyOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CopyOpInterface.td",
    deps = [":CopyOpInterfaceTdFiles"],
)

gentbl_cc_library(
    name = "TransformsPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Transforms",
            ],
            "include/mlir/Transforms/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Transforms",
            ],
            "include/mlir/Transforms/Transforms.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Transforms",
            ],
            "include/mlir/Transforms/Transforms.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Transforms/Passes.td",
    deps = [
        ":PassBaseTdFiles",
        ":RewritePassBaseTdFiles",
    ],
)

cc_library(
    name = "Transforms",
    srcs = glob([
        "lib/Transforms/*.cpp",
        "lib/Transforms/*.h",
    ]),
    hdrs = glob(["include/mlir/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ControlFlowInterfaces",
        ":IR",
        ":LoopLikeInterface",
        ":Pass",
        ":Rewrite",
        ":Support",
        ":TransformUtils",
        ":TransformsPassIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "CommonFolders",
    srcs = [
    ],
    hdrs = ["include/mlir/Dialect/CommonFolders.h"],
    includes = ["include"],
    deps = [
        ":IR",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToGPU",
    srcs = glob(["lib/Conversion/SCFToGPU/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/SCFToGPU/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineToStandard",
        ":ArithmeticDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":GPUDialect",
        ":GPUTransforms",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToSPIRV",
    srcs = glob([
        "lib/Conversion/SCFToSPIRV/*.cpp",
        "lib/Conversion/SCFToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/SCFToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticToSPIRV",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToSPIRV",
        ":IR",
        ":MemRefToSPIRV",
        ":Pass",
        ":SCFDialect",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "SCFToOpenMP",
    srcs = [
        "lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = ["include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"],
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":Analysis",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":OpenMPDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
    ],
)

cc_library(
    name = "SCFToControlFlow",
    srcs = [
        "lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = ["include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":TransformUtils",
        ":Transforms",
    ],
)

cc_library(
    name = "LLVMCommonConversion",
    srcs = glob([
        "lib/Conversion/LLVMCommon/*.cpp",
    ]) + ["lib/Conversion/LLVMCommon/MemRefDescriptor.h"],
    hdrs = glob(["include/mlir/Conversion/LLVMCommon/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMDialect",
        ":Support",
        ":Transforms",
        "//llvm:Core",
    ],
)

cc_library(
    name = "ReconcileUnrealizedCasts",
    srcs = glob(["lib/Conversion/ReconcileUnrealizedCasts/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/ReconcileUnrealizedCasts/*.h"]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":TransformUtils",
    ],
)

cc_library(
    name = "FuncToLLVM",
    srcs = [
        "lib/Conversion/FuncToLLVM/FuncToLLVM.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = [
        "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h",
        "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":DataLayoutInterfaces",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MemRefDialect",
        ":Parser",
        ":Pass",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ControlFlowToLLVM",
    srcs = [
        "lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = [
        "include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticToLLVM",
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":DataLayoutInterfaces",
        ":DialectUtils",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":MemRefDialect",
        ":Parser",
        ":Pass",
        ":Support",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ControlFlowToSPIRV",
    srcs = glob(["lib/Conversion/ControlFlowToSPIRV/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/ControlFlowToSPIRV/*.h"]),
    includes = ["include"],
    deps = [
        ":ControlFlowDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVUtils",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemRefToLLVM",
    srcs = glob(["lib/Conversion/MemRefToLLVM/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/MemRefToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":DataLayoutInterfaces",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MemRefToSPIRV",
    srcs = glob([
        "lib/Conversion/MemRefToSPIRV/*.cpp",
        "lib/Conversion/MemRefToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/MemRefToSPIRV/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/MemRefToSPIRV",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArithmeticToLLVM",
    srcs = glob(["lib/Conversion/ArithmeticToLLVM/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/ArithmeticToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":Support",
        ":Transforms",
    ],
)

cc_library(
    name = "ArithmeticToSPIRV",
    srcs = glob(["lib/Conversion/ArithmeticToSPIRV/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/ArithmeticToSPIRV/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncToSPIRV",
        ":IR",
        ":Pass",
        ":SPIRVCommonConversion",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":Support",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathToLLVM",
    srcs = glob(["lib/Conversion/MathToLLVM/*.cpp"]) + [":ConversionPassDetail"],
    hdrs = glob(["include/mlir/Conversion/MathToLLVM/*.h"]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ConversionPassIncGen",
        ":DataLayoutInterfaces",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
        ":Support",
        ":Transforms",
    ],
)

gentbl_cc_library(
    name = "CallOpInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CallInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CallInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CallInterfaces.td",
    deps = [":CallInterfacesTdFiles"],
)

cc_library(
    name = "CallOpInterfaces",
    srcs = ["lib/Interfaces/CallInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/CallInterfaces.h"],
    includes = ["include"],
    deps = [
        ":CallOpInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "CastOpInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/CastInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/CastInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/CastInterfaces.td",
    deps = [":CastInterfacesTdFiles"],
)

cc_library(
    name = "CastOpInterfaces",
    srcs = ["lib/Interfaces/CastInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/CastInterfaces.h"],
    includes = ["include"],
    deps = [
        ":CastOpInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ControlFlowInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/ControlFlowInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/ControlFlowInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/ControlFlowInterfaces.td",
    deps = [":ControlFlowInterfacesTdFiles"],
)

cc_library(
    name = "ControlFlowInterfaces",
    srcs = ["lib/Interfaces/ControlFlowInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/ControlFlowInterfaces.h"],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesIncGen",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "InferTypeOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/InferTypeOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/InferTypeOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/InferTypeOpInterface.td",
    deps = [":InferTypeOpInterfaceTdFiles"],
)

cc_library(
    name = "InferTypeOpInterface",
    srcs = ["lib/Interfaces/InferTypeOpInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/InferTypeOpInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":InferTypeOpInterfaceIncGen",
        ":Support",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "SideEffectInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/SideEffectInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/SideEffectInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/SideEffectInterfaces.td",
    deps = [":SideEffectInterfacesTdFiles"],
)

cc_library(
    name = "SideEffectInterfaces",
    srcs = ["lib/Interfaces/SideEffectInterfaces.cpp"],
    hdrs = ["include/mlir/Interfaces/SideEffectInterfaces.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":SideEffectInterfacesIncGen",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "TilingInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Interfaces/TilingInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Interfaces/TilingInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Interfaces/TilingInterface.td",
    deps = [":TilingInterfaceTdFiles"],
)

cc_library(
    name = "Analysis",
    srcs = glob(
        [
            "lib/Analysis/*.cpp",
            "lib/Analysis/*.h",
            "lib/Analysis/*/*.cpp",
            "lib/Analysis/*/*.h",
        ],
    ),
    hdrs = glob(
        [
            "include/mlir/Analysis/*.h",
            "include/mlir/Analysis/*/*.h",
        ],
    ),
    includes = ["include"],
    deps = [
        ":CallOpInterfaces",
        ":ControlFlowInterfaces",
        ":DataLayoutInterfaces",
        ":IR",
        ":InferIntRangeInterface",
        ":LoopLikeInterface",
        ":SideEffectInterfaces",
        ":Support",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TranslateLib",
    srcs = glob(["lib/Tools/mlir-translate/*.cpp"]),
    hdrs = glob(["include/mlir/Tools/mlir-translate/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ToLLVMIRTranslation",
    srcs = [
        "lib/Target/LLVMIR/DebugTranslation.cpp",
        "lib/Target/LLVMIR/DebugTranslation.h",
        "lib/Target/LLVMIR/ModuleTranslation.cpp",
        "lib/Target/LLVMIR/TypeToLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Target/LLVMIR/Export.h",
        "include/mlir/Target/LLVMIR/LLVMTranslationInterface.h",
        "include/mlir/Target/LLVMIR/ModuleTranslation.h",
        "include/mlir/Target/LLVMIR/TypeToLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":DLTIDialect",
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMIntrinsicConversionIncGen",
        ":OpenMPDialect",
        ":Support",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
        "//llvm:TransformUtils",
    ],
)

cc_library(
    name = "AMXToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/AMX/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/AMX/*.h"]),
    includes = ["include"],
    deps = [
        ":AMXConversionIncGen",
        ":AMXDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "X86VectorToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/X86Vector/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/X86Vector/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ToLLVMIRTranslation",
        ":X86VectorConversionIncGen",
        ":X86VectorDialect",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmNeonToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ArmNeon/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmNeon/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmNeonConversionIncGen",
        ":ArmNeonDialect",
        ":ArmNeonIncGen",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArmSVEToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ArmSVE/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmSVE/*.h"]),
    includes = ["include"],
    deps = [
        ":ArmSVEConversionIncGen",
        ":ArmSVEDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "NVVMToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/NVVM/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/NVVM/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":NVVMConversionIncGen",
        ":NVVMDialect",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ROCDLToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/ROCDL/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ROCDL/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":ROCDLConversionIncGen",
        ":ROCDLDialect",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LLVMToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/LLVMIR/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/LLVMIR/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIntrinsicConversionIncGen",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenACCToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/OpenACC/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenACC/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":LLVMDialect",
        ":OpenACCDialect",
        ":OpenACCToLLVM",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenMPToLLVMIRTranslation",
    srcs = glob(["lib/Target/LLVMIR/Dialect/OpenMP/*.cpp"]),
    hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenMP/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":OpenMPDialect",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:FrontendOpenMP",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AllToLLVMIRTranslations",
    hdrs = ["include/mlir/Target/LLVMIR/Dialect/All.h"],
    includes = ["include"],
    deps = [
        ":AMXToLLVMIRTranslation",
        ":ArmNeonToLLVMIRTranslation",
        ":ArmSVEToLLVMIRTranslation",
        ":LLVMToLLVMIRTranslation",
        ":NVVMToLLVMIRTranslation",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":ROCDLToLLVMIRTranslation",
        ":X86VectorToLLVMIRTranslation",
    ],
)

cc_library(
    name = "ToLLVMIRTranslationRegistration",
    srcs = ["lib/Target/LLVMIR/ConvertToLLVMIR.cpp"],
    includes = ["include"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":DLTIDialect",
        ":FuncDialect",
        ":IR",
        ":ToLLVMIRTranslation",
        ":TranslateLib",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "FromLLVMIRTranslation",
    srcs = [
        "lib/Target/LLVMIR/ConvertFromLLVMIR.cpp",
        "lib/Target/LLVMIR/TypeFromLLVM.cpp",
    ],
    hdrs = [
        "include/mlir/Target/LLVMIR/Import.h",
        "include/mlir/Target/LLVMIR/TypeFromLLVM.h",
    ],
    includes = ["include"],
    deps = [
        ":DLTIDialect",
        ":IR",
        ":LLVMConversionIncGen",
        ":LLVMDialect",
        ":LLVMIntrinsicConversionIncGen",
        ":Support",
        ":TranslateLib",
        "//llvm:Core",
        "//llvm:IRReader",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ExecutionEngine",
    srcs = [
        "include/mlir/ExecutionEngine/CRunnerUtils.h",
        "lib/ExecutionEngine/ExecutionEngine.cpp",
    ],
    hdrs = [
        "include/mlir/ExecutionEngine/ExecutionEngine.h",
        "include/mlir/ExecutionEngine/MemRefUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":IR",
        ":LLVMDialect",
        ":Support",
        ":ToLLVMIRTranslation",
        "//llvm:AllTargetsAsmParsers",
        "//llvm:BitWriter",
        "//llvm:Core",
        "//llvm:ExecutionEngine",
        "//llvm:MC",
        "//llvm:OrcJIT",
        "//llvm:Support",
        "//llvm:Target",  # fixdeps: keep
        "//llvm:TransformUtils",
        "//llvm:X86CodeGen",  # fixdeps: keep
        "//llvm:X86Disassembler",  # fixdeps: keep
    ],
)

cc_library(
    name = "ExecutionEngineUtils",
    srcs = ["lib/ExecutionEngine/OptUtils.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/OptUtils.h"],
    includes = ["include"],
    deps = [
        "//llvm:Analysis",
        "//llvm:Core",
        "//llvm:Coroutines",
        "//llvm:IPO",
        "//llvm:Passes",
        "//llvm:Support",
        "//llvm:Target",
        "//llvm:common_transforms",
    ],
)

cc_library(
    name = "MlirOptLib",
    srcs = ["lib/Tools/mlir-opt/MlirOptMain.cpp"],
    hdrs = ["include/mlir/Tools/mlir-opt/MlirOptMain.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "AllTranslations",
    hdrs = ["include/mlir/InitAllTranslations.h"],
    deps = [
        ":FromLLVMIRTranslation",
        ":SPIRVTranslateRegistration",
        ":TargetCpp",
        ":ToLLVMIRTranslationRegistration",
    ],
)

cc_library(
    name = "MlirTranslateMain",
    srcs = ["tools/mlir-translate/mlir-translate.cpp"],
    deps = [
        ":AllPassesAndDialects",
        ":AllTranslations",
        ":Support",
        ":TranslateLib",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-translate",
    deps = [":MlirTranslateMain"],
)

cc_library(
    name = "AllPassesAndDialects",
    hdrs = [
        "include/mlir/InitAllDialects.h",
        "include/mlir/InitAllPasses.h",
    ],
    deps = [
        ":AMDGPUDialect",
        ":AMDGPUToROCDL",
        ":AMXDialect",
        ":AMXTransforms",
        ":AffineDialect",
        ":AffinePassIncGen",
        ":AffineToStandard",
        ":AffineTransforms",
        ":ArithmeticDialect",
        ":ArithmeticToLLVM",
        ":ArithmeticToSPIRV",
        ":ArithmeticTransforms",
        ":ArmNeonDialect",
        ":ArmSVEDialect",
        ":ArmSVETransforms",
        ":AsyncDialect",
        ":AsyncPassIncGen",
        ":AsyncToLLVM",
        ":AsyncTransforms",
        ":BufferizationDialect",
        ":BufferizationTransformOps",
        ":BufferizationTransforms",
        ":ComplexDialect",
        ":ComplexToLLVM",
        ":ComplexToLibm",
        ":ControlFlowDialect",
        ":ConversionPasses",
        ":DLTIDialect",
        ":EmitCDialect",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":FuncTransforms",
        ":FuncTransformsPassIncGen",
        ":GPUDialect",
        ":GPUPassIncGen",
        ":GPUToGPURuntimeTransforms",
        ":GPUToNVVMTransforms",
        ":GPUToROCDLTransforms",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":GPUTransforms",
        ":IR",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMPassIncGen",
        ":LinalgDialect",
        ":LinalgPassIncGen",
        ":LinalgToLLVM",
        ":LinalgToSPIRV",
        ":LinalgToStandard",
        ":LinalgTransformOps",
        ":LinalgTransforms",
        ":MLProgramDialect",
        ":MathDialect",
        ":MathToLLVM",
        ":MathToLibm",
        ":MathToSPIRV",
        ":MathTransforms",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":MemRefToSPIRV",
        ":MemRefTransforms",
        ":NVGPUDialect",
        ":NVGPUPassIncGen",
        ":NVGPUToNVVM",
        ":NVGPUTransforms",
        ":NVVMDialect",
        ":OpenACCDialect",
        ":OpenMPDialect",
        ":OpenMPToLLVM",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":PDLToPDLInterp",
        ":QuantOps",
        ":QuantPassIncGen",
        ":ROCDLDialect",
        ":ReconcileUnrealizedCasts",
        ":SCFDialect",
        ":SCFPassIncGen",
        ":SCFToControlFlow",
        ":SCFToGPU",
        ":SCFTransformOps",
        ":SCFTransforms",
        ":SDBM",
        ":SPIRVDialect",
        ":SPIRVPassIncGen",
        ":SPIRVToLLVM",
        ":SPIRVTransforms",
        ":ShapeDialect",
        ":ShapeToStandard",
        ":ShapeTransforms",
        ":ShapeTransformsPassIncGen",
        ":SparseTensorDialect",
        ":SparseTensorPipelines",
        ":SparseTensorTransforms",
        ":TensorDialect",
        ":TensorInferTypeOpInterfaceImpl",
        ":TensorTilingInterfaceImpl",
        ":TensorTransforms",
        ":TosaDialect",
        ":TosaToLinalg",
        ":TransformDialect",
        ":TransformDialectTransforms",
        ":Transforms",
        ":TransformsPassIncGen",
        ":VectorDialect",
        ":VectorToLLVM",
        ":VectorToSCF",
        ":VectorToSPIRV",
        ":VectorTransforms",
        ":X86VectorDialect",
        ":X86VectorTransforms",
    ],
)

cc_binary(
    name = "mlir-lsp-server",
    srcs = ["tools/mlir-lsp-server/mlir-lsp-server.cpp"],
    includes = ["include"],
    deps = [
        ":AllPassesAndDialects",
        ":IR",
        ":MlirLspServerLib",
    ],
)

cc_binary(
    name = "mlir-opt",
    srcs = ["tools/mlir-opt/mlir-opt.cpp"],
    local_defines = ["MLIR_INCLUDE_TESTS"],
    deps = [
        ":AllPassesAndDialects",
        ":Analysis",
        ":IR",
        ":MlirOptLib",
        ":OpenMPDialect",
        ":Pass",
        ":QuantOps",
        ":SCFToGPU",
        ":Support",
        ":Transforms",
        "//llvm:AllTargetsCodeGens",
        "//llvm:Support",
        "//mlir/test:TestAffine",
        "//mlir/test:TestAnalysis",
        "//mlir/test:TestDLTI",
        "//mlir/test:TestDialect",
        "//mlir/test:TestFunc",
        "//mlir/test:TestFuncToLLVM",
        "//mlir/test:TestGPU",
        "//mlir/test:TestIR",
        "//mlir/test:TestLinalg",
        "//mlir/test:TestMath",
        "//mlir/test:TestMemRef",
        "//mlir/test:TestPDLL",
        "//mlir/test:TestPass",
        "//mlir/test:TestReducer",
        "//mlir/test:TestRewrite",
        "//mlir/test:TestSCF",
        "//mlir/test:TestSPIRV",
        "//mlir/test:TestShapeDialect",
        "//mlir/test:TestTensor",
        "//mlir/test:TestTilingInterface",
        "//mlir/test:TestTosaDialect",
        "//mlir/test:TestTransformDialect",
        "//mlir/test:TestTransforms",
        "//mlir/test:TestTypeDialect",
        "//mlir/test:TestVector",
    ],
)

cc_library(
    name = "MlirJitRunner",
    srcs = ["lib/ExecutionEngine/JitRunner.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/JitRunner.h"],
    includes = ["include"],
    deps = [
        ":AllPassesAndDialects",
        ":ExecutionEngine",
        ":ExecutionEngineUtils",
        ":IR",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":Parser",
        ":SCFToControlFlow",
        ":Support",
        "//llvm:Core",
        "//llvm:OrcJIT",
        "//llvm:Support",
    ],
)

cc_library(
    name = "mlir_c_runner_utils",
    srcs = [
        "lib/ExecutionEngine/CRunnerUtils.cpp",
        "lib/ExecutionEngine/Float16bits.cpp",
        "lib/ExecutionEngine/SparseTensorUtils.cpp",
    ],
    hdrs = [
        "include/mlir/ExecutionEngine/CRunnerUtils.h",
        "include/mlir/ExecutionEngine/Float16bits.h",
        "include/mlir/ExecutionEngine/Msan.h",
        "include/mlir/ExecutionEngine/SparseTensorUtils.h",
    ],
    includes = ["include"],
)

cc_library(
    name = "mlir_async_runtime_api",
    hdrs = ["include/mlir/ExecutionEngine/AsyncRuntime.h"],
    includes = ["include"],
)

cc_library(
    name = "mlir_async_runtime",
    srcs = ["lib/ExecutionEngine/AsyncRuntime.cpp"],
    copts = ["-Dmlir_async_runtime_EXPORTS"],
    deps = [
        ":mlir_async_runtime_api",
        "//llvm:Support",
    ],
)

cc_library(
    name = "mlir_runner_utils",
    srcs = ["lib/ExecutionEngine/RunnerUtils.cpp"],
    hdrs = ["include/mlir/ExecutionEngine/RunnerUtils.h"],
    includes = ["include"],
    deps = [":mlir_c_runner_utils"],
)

cc_binary(
    name = "mlir-cpu-runner",
    srcs = ["tools/mlir-cpu-runner/mlir-cpu-runner.cpp"],
    deps = [
        ":AllToLLVMIRTranslations",
        ":ExecutionEngineUtils",
        ":IR",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":MlirJitRunner",
        ":OpenACCToLLVMIRTranslation",
        ":OpenMPToLLVMIRTranslation",
        ":ToLLVMIRTranslation",
        "//llvm:AsmParser",
        "//llvm:Support",
        "//llvm:X86AsmParser",
    ],
)

# This target provides the headers from LLVM's Support target without any of
# the symbols. In particular, it does not contain the static registration code
# which may be executed by at most one shared library loaded by ORCJit. Direct
# dependencies need to avoid requiring symbols from LLVMSupport by adding
# copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"].
#
# Bazel links the dependencies' object files instead of the archives, which
# means that symbols are linked in even if none are used. The LLVM cmake build
# on the other hand links archives (or shared libraries, depending on
# BUILD_SHARED_LIBS), skipping them if none of the symbols are used.
# See also https://reviews.llvm.org/D95613.
cc_headers_only(
    name = "LLVMSupportHeaders",
    src = "//llvm:Support",
)

cc_library(
    name = "mlir_cuda_runtime",
    srcs = ["lib/ExecutionEngine/CudaRuntimeWrappers.cpp"],
    # Prevent needing EnableABIBreakingChecks symbol from LLVMSupport.
    copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"],
    tags = [
        "manual",  # External dependency
        "nobuildkite",  # TODO(gcmn): Add support for this target
    ],
    deps = [
        ":LLVMSupportHeaders",
        ":mlir_c_runner_utils",
        "@cuda//:cuda_headers",
        "@cuda//:libcuda",
    ],
)

cc_library(
    name = "VulkanRuntime",
    srcs = ["tools/mlir-vulkan-runner/VulkanRuntime.cpp"],
    hdrs = ["tools/mlir-vulkan-runner/VulkanRuntime.h"],
    tags = [
        "manual",  # External dependency
    ],
    deps = [
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":SPIRVDialect",
        ":SideEffectInterfaces",
        ":Support",
        "//llvm:Support",
        "@vulkan_headers",
        "@vulkan_sdk//:sdk",
    ],
)

cc_binary(
    name = "tools/libvulkan-runtime-wrappers.so",
    srcs = ["tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp"],
    linkshared = True,
    tags = [
        "manual",  # External dependency
    ],
    deps = [
        ":VulkanRuntime",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-vulkan-runner",
    srcs = ["tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp"],
    deps = [
        ":ArithmeticDialect",
        ":ExecutionEngineUtils",
        ":FuncDialect",
        ":FuncToLLVM",
        ":FuncToSPIRV",
        ":GPUDialect",
        ":GPUToSPIRV",
        ":GPUToVulkanTransforms",
        ":GPUTransforms",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":LLVMIRTransforms",
        ":LLVMToLLVMIRTranslation",
        ":MemRefDialect",
        ":MemRefToLLVM",
        ":MemRefTransforms",
        ":MlirJitRunner",
        ":Pass",
        ":ReconcileUnrealizedCasts",
        ":SPIRVDialect",
        ":SPIRVTransforms",
        ":ToLLVMIRTranslation",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-spirv-cpu-runner",
    srcs = ["tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp"],
    deps = [
        ":ArithmeticDialect",
        ":ExecutionEngineUtils",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":GPUToSPIRV",
        ":GPUTransforms",
        ":LLVMDialect",
        ":LLVMToLLVMIRTranslation",
        ":MemRefDialect",
        ":MlirJitRunner",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":SPIRVToLLVM",
        ":SPIRVTransforms",
        ":ToLLVMIRTranslation",
        "//llvm:Core",
        "//llvm:Linker",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TableGen",
    srcs = glob(["lib/TableGen/*.cpp"]),
    hdrs = glob(["include/mlir/TableGen/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
        "//llvm:TableGen",
    ],
)

cc_library(
    name = "MlirTableGenMain",
    srcs = ["tools/mlir-tblgen/mlir-tblgen.cpp"],
    includes = ["include"],
    deps = [
        ":TableGen",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-tblgen",
    srcs = glob([
        "tools/mlir-tblgen/*.h",
        "tools/mlir-tblgen/*.cpp",
    ]),
    deps = [
        ":MlirTableGenMain",
        ":Support",
        ":TableGen",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-linalg-ods-yaml-gen",
    srcs = [
        "tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp",
    ],
    deps = [
        ":AsmParser",
        ":IR",
        ":Support",
        "//llvm:Support",
        "//llvm:TableGen",
        "//llvm:config",
    ],
)

## OpenACC dialect

# TODO(gcmn): This is sticking td files in a cc_library
gentbl_cc_library(
    name = "AccCommonGen",
    includes = ["/llvm/include"],
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-directive-decl",
                "-directives-dialect=OpenACC",
            ],
            "include/mlir/Dialect/OpenACC/AccCommon.td",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "//llvm:include/llvm/Frontend/OpenACC/ACC.td",
    deps = ["//llvm:acc_td_files"],
)

td_library(
    name = "OpenAccOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/OpenACC/AccCommon.td",
        "include/mlir/Dialect/OpenACC/OpenACCOps.td",
    ],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "OpenACCOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=acc",
            ],
            "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/OpenACC/OpenACCOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenACC/OpenACCOps.td",
    deps = [":OpenAccOpsTdFiles"],
)

cc_library(
    name = "OpenACCDialect",
    srcs = glob(
        [
            "lib/Dialect/OpenACC/IR/*.cpp",
            "lib/Dialect/OpenACC/IR/*.h",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/OpenACC/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":IR",
        ":OpenACCOpsIncGen",
        ":Transforms",
        "//llvm:Support",
    ],
)

## OpenMP dialect

# TODO(gcmn): This is sticking td files in a cc_library
gentbl_cc_library(
    name = "OmpCommonTdGen",
    includes = ["/llvm/include"],
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-directive-decl",
                "-directives-dialect=OpenMP",
            ],
            "include/mlir/Dialect/OpenMP/OmpCommon.td",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "//llvm:include/llvm/Frontend/OpenMP/OMP.td",
    deps = [
        ":OpBaseTdFiles",
        "//llvm:omp_td_files",
    ],
)

td_library(
    name = "OpenMPOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/OpenMP/OmpCommon.td",
        "include/mlir/Dialect/OpenMP/OpenMPOps.td",
        "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td",
        "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td",
    ],
    deps = [
        ":LLVMOpsTdFiles",
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "OpenMPOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc",
        ),
        (
            [
                "-gen-attrdef-decls",
                "-attrdefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc",
        ),
        (
            [
                "-gen-attrdef-defs",
                "-attrdefs-dialect=omp",
            ],
            "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/OpenMP/OpenMPOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPOps.td",
    deps = [":OpenMPOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenMPTypeInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-type-interface-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc",
        ),
        (
            ["-gen-type-interface-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td",
    deps = [":OpenMPOpsTdFiles"],
)

gentbl_cc_library(
    name = "OpenMPInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td",
    deps = [":OpenMPOpsTdFiles"],
)

cc_library(
    name = "OpenMPDialect",
    srcs = glob(
        [
            "lib/Dialect/OpenMP/IR/*.cpp",
            "lib/Dialect/OpenMP/IR/*.h",
        ],
    ),
    hdrs = glob([
        "include/mlir/Dialect/OpenMP/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ControlFlowInterfaces",
        ":IR",
        ":LLVMDialect",
        ":OpenMPInterfacesIncGen",
        ":OpenMPOpsIncGen",
        ":OpenMPTypeInterfacesIncGen",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenACCToSCF",
    srcs = glob([
        "lib/Conversion/OpenACCToSCF/*.cpp",
        "lib/Conversion/OpenACCToSCF/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/OpenACCToSCF/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":OpenACCDialect",
        ":Pass",
        ":SCFDialect",
        ":Transforms",
    ],
)

cc_library(
    name = "OpenACCToLLVM",
    srcs = glob([
        "lib/Conversion/OpenACCToLLVM/*.cpp",
        "lib/Conversion/OpenACCToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/OpenACCToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":OpenACCDialect",
        ":Pass",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "OpenMPToLLVM",
    srcs = glob([
        "lib/Conversion/OpenMPToLLVM/*.cpp",
        "lib/Conversion/OpenMPToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/OpenMPToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticToLLVM",
        ":ControlFlowToLLVM",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefToLLVM",
        ":OpenMPDialect",
        ":Pass",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "QuantizationOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Quant/QuantOps.td",
        "include/mlir/Dialect/Quant/QuantOpsBase.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "QuantOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Quant/QuantOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Quant/QuantOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Quant/QuantOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Quant/QuantOpsDialect.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/QuantOps/QuantOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Quant/QuantOps.td",
    deps = [":QuantizationOpsTdFiles"],
)

gentbl_cc_library(
    name = "QuantPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Quant",
            ],
            "include/mlir/Dialect/Quant/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Quant/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "QuantOps",
    srcs = [
        "lib/Dialect/Quant/IR/QuantOps.cpp",
        "lib/Dialect/Quant/IR/QuantTypes.cpp",
        "lib/Dialect/Quant/IR/TypeDetail.h",
        "lib/Dialect/Quant/IR/TypeParser.cpp",
        "lib/Dialect/Quant/Transforms/ConvertConst.cpp",
        "lib/Dialect/Quant/Transforms/ConvertSimQuant.cpp",
        "lib/Dialect/Quant/Transforms/PassDetail.h",
        "lib/Dialect/Quant/Utils/FakeQuantSupport.cpp",
        "lib/Dialect/Quant/Utils/QuantizeUtils.cpp",
        "lib/Dialect/Quant/Utils/UniformSupport.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Quant/FakeQuantSupport.h",
        "include/mlir/Dialect/Quant/Passes.h",
        "include/mlir/Dialect/Quant/QuantOps.h",
        "include/mlir/Dialect/Quant/QuantTypes.h",
        "include/mlir/Dialect/Quant/QuantizeUtils.h",
        "include/mlir/Dialect/Quant/UniformSupport.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":Pass",
        ":QuantOpsIncGen",
        ":QuantPassIncGen",
        ":SideEffectInterfaces",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

td_library(
    name = "LinalgOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Linalg/IR/LinalgBase.td",
        "include/mlir/Dialect/Linalg/IR/LinalgOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":TilingInterfaceTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

td_library(
    name = "LinalgTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":PDLDialectTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=linalg",
            ],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=linalg",
            ],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgOps.td",
    deps = [":LinalgOpsTdFiles"],
)

gentbl_cc_library(
    name = "LinalgTransformOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td",
    deps = [
        ":LinalgTransformOpsTdFiles",
    ],
)

genlinalg(
    name = "LinalgNamedStructuredOpsYamlIncGen",
    src = "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml",
    linalg_outs = [
        (
            "-o-impl=$@",
            "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc",
        ),
        (
            "-o-ods-decl=$@",
            "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td",
        ),
    ],
    linalggen = ":mlir-linalg-ods-yaml-gen",
)

td_library(
    name = "LinalgStructuredOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td",
        "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td",
        "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CopyOpInterfaceTdFiles",
        ":LinalgOpsTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgStructuredOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td",
    deps = [":LinalgStructuredOpsTdFiles"],
)

gentbl_cc_library(
    name = "LinalgInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td",
    deps = [":LinalgStructuredOpsTdFiles"],
)

td_library(
    name = "BufferizableOpInterfaceTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td",
    ],
    includes = ["include"],
    deps = [
        ":OpBaseTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizableOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td",
    deps = [
        ":BufferizableOpInterfaceTdFiles",
    ],
)

td_library(
    name = "LinalgDocTdFiles",
    srcs = ["include/mlir/Dialect/Linalg/IR/LinalgDoc.td"],
    includes = ["include"],
    deps = [
        ":LinalgOpsTdFiles",
        ":LinalgStructuredOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "LinalgDocIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Linalg/LinalgOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/IR/LinalgDoc.td",
    deps = [":LinalgDocTdFiles"],
)

cc_library(
    name = "LinalgToLLVM",
    srcs = glob([
        "lib/Conversion/LinalgToLLVM/*.cpp",
        "lib/Conversion/LinalgToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/LinalgToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineToStandard",
        ":Analysis",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":MemRefToLLVM",
        ":Pass",
        ":SCFDialect",
        ":SCFToControlFlow",
        ":Support",
        ":Transforms",
        ":VectorToLLVM",
        ":VectorToSCF",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgToStandard",
    srcs = glob([
        "lib/Conversion/LinalgToStandard/*.cpp",
        "lib/Conversion/LinalgToStandard/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/LinalgToStandard/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgToSPIRV",
    srcs = glob([
        "lib/Conversion/LinalgToSPIRV/*.cpp",
        "lib/Conversion/LinalgToSPIRV/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/LinalgToSPIRV/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":LinalgTransforms",
        ":LinalgUtils",
        ":Pass",
        ":SPIRVConversion",
        ":SPIRVDialect",
        ":TransformUtils",
    ],
)

cc_library(
    name = "LinalgDialect",
    srcs = glob(["lib/Dialect/Linalg/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Linalg/IR/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":AsmParser",
        ":BufferizationDialect",
        ":ComplexDialect",
        ":ControlFlowInterfaces",
        ":CopyOpInterface",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":LinalgInterfacesIncGen",
        ":LinalgNamedStructuredOpsYamlIncGen",
        ":LinalgOpsIncGen",
        ":LinalgStructuredOpsIncGen",
        ":MathDialect",
        ":MemRefDialect",
        ":Parser",
        ":SCFDialect",
        ":SideEffectInterfaces",
        ":SparseTensorDialect",
        ":Support",
        ":TensorDialect",
        ":TilingInterface",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgTransformOps",
    srcs = [
        "lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":ArithmeticDialect",
        ":AsmParser",
        ":ControlFlowDialect",
        ":IR",
        ":LinalgDialect",
        ":LinalgTransformOpsIncGen",
        ":LinalgTransforms",
        ":PDLDialect",
        ":Parser",
        ":SideEffectInterfaces",
        ":TilingInterface",
        ":TransformDialect",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "LinalgPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.h.inc",
        ),
        (
            [
                "-gen-pass-capi-header",
                "--prefix=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.capi.h.inc",
        ),
        (
            [
                "-gen-pass-capi-impl",
                "--prefix=Linalg",
            ],
            "include/mlir/Dialect/Linalg/Passes.capi.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Linalg/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "LinalgAnalysis",
    srcs = glob([
        "lib/Dialect/Linalg/Analysis/*.cpp",
        "lib/Dialect/Linalg/Analysis/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Linalg/Analysis/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgUtils",
    srcs = glob([
        "lib/Dialect/Linalg/Utils/*.cpp",
        "lib/Dialect/Linalg/Utils/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Linalg/Utils/*.h",
    ]),
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffineUtils",
        ":Analysis",
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgAnalysis",
        ":LinalgDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "LinalgTransforms",
    srcs = glob([
        "lib/Dialect/Linalg/Transforms/*.cpp",
        "lib/Dialect/Linalg/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Linalg/Passes.h",
    ] + glob([
        "include/mlir/Dialect/Linalg/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineAnalysis",
        ":AffineDialect",
        ":AffineUtils",
        ":Analysis",
        ":ArithmeticDialect",
        ":ArithmeticTransforms",
        ":ArithmeticUtils",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":ComplexDialect",
        ":ControlFlowDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncTransforms",
        ":IR",
        ":LinalgAnalysis",
        ":LinalgDialect",
        ":LinalgPassIncGen",
        ":LinalgStructuredOpsIncGen",
        ":LinalgUtils",
        ":MathDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":SCFTransforms",
        ":SCFUtils",
        ":SparseTensorDialect",
        ":Support",
        ":TensorDialect",
        ":TensorTilingInterfaceImpl",
        ":TensorTransforms",
        ":TensorUtils",
        ":TilingInterface",
        ":TransformUtils",
        ":Transforms",
        ":VectorDialect",
        ":VectorToSCF",
        ":VectorTransforms",
        ":VectorUtils",
        ":X86VectorTransforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TilingInterface",
    srcs = ["lib/Interfaces/TilingInterface.cpp"],
    hdrs = ["include/mlir/Interfaces/TilingInterface.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Support",
        ":TilingInterfaceIncGen",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

td_library(
    name = "VectorOpsTdFiles",
    srcs = ["include/mlir/Dialect/Vector/IR/VectorOps.td"],
    includes = ["include"],
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "VectorOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Vector/IR/VectorOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Vector/IR/VectorOps.cpp.inc",
        ),
        (
            [
                "-gen-dialect-decls",
                "-dialect=vector",
            ],
            "include/mlir/Dialect/Vector/IR/VectorOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=vector",
            ],
            "include/mlir/Dialect/Vector/IR/VectorOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Vector/IR/VectorOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Vector/IR/VectorOpsEnums.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Vector/VectorOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Vector/IR/VectorOps.td",
    deps = [":VectorOpsTdFiles"],
)

cc_library(
    name = "VectorToLLVM",
    srcs = glob([
        "lib/Conversion/VectorToLLVM/*.cpp",
        "lib/Conversion/VectorToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/VectorToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AMXDialect",
        ":AMXTransforms",
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":ArmNeonDialect",
        ":ArmSVEDialect",
        ":ArmSVETransforms",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":Support",
        ":ToLLVMIRTranslation",
        ":Transforms",
        ":VectorDialect",
        ":VectorTransforms",
        ":X86VectorDialect",
        ":X86VectorTransforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToGPU",
    srcs = glob([
        "lib/Conversion/VectorToGPU/*.cpp",
        "lib/Conversion/VectorToGPU/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/VectorToGPU/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":Analysis",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":FuncToLLVM",
        ":GPUDialect",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":NVGPUDialect",
        ":NVVMDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        ":VectorDialect",
        ":VectorUtils",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "VectorToSCF",
    srcs = glob([
        "lib/Conversion/VectorToSCF/*.cpp",
        "lib/Conversion/VectorToSCF/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/VectorToSCF/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":FuncToLLVM",
        ":IR",
        ":LLVMDialect",
        ":MemRefDialect",
        ":Pass",
        ":SCFDialect",
        ":Support",
        ":Transforms",
        ":VectorDialect",
        ":VectorTransforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "TosaDialectTdFiles",
    srcs = glob(["include/mlir/Dialect/Tosa/IR/*.td"]),
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":LoopLikeInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TosaDialectIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.cpp.inc",
        ),
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaAttributes.cpp.inc",
        ),
        (
            ["-gen-op-doc"],
            "g3doc/Dialects/Tosa/TosaOps.md",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/IR/TosaOps.td",
    deps = [":TosaDialectTdFiles"],
)

gentbl_cc_library(
    name = "TosaInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Tosa/IR/TosaInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/IR/TosaInterfaces.td",
    deps = [":TosaDialectTdFiles"],
)

gentbl_cc_library(
    name = "TosaPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=TosaOpt",
            ],
            "include/mlir/Dialect/Tosa/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Tosa/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "TosaDialect",
    srcs = glob([
        "lib/Dialect/Tosa/IR/*.cpp",
        "lib/Dialect/Tosa/IR/*.h",
        "lib/Dialect/Tosa/Utils/*.cpp",
        "lib/Dialect/Tosa/Transforms/*.cpp",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/Tosa/IR/*.h",
        "include/mlir/Dialect/Tosa/Utils/*.h",
        "include/mlir/Dialect/Tosa/Transforms/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticDialect",
        ":Dialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":LoopLikeInterface",
        ":Pass",
        ":QuantOps",
        ":TensorDialect",
        ":TosaDialectIncGen",
        ":TosaInterfacesIncGen",
        ":TosaPassIncGen",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "TosaToArith",
    srcs = glob([
        "lib/Conversion/TosaToArith/*.cpp",
        "lib/Conversion/TosaToArith/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TosaToArith/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToArith",
    ],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":TosaDialect",
        ":Transforms",
    ],
)

cc_library(
    name = "TosaToLinalg",
    srcs = glob([
        "lib/Conversion/TosaToLinalg/*.cpp",
        "lib/Conversion/TosaToLinalg/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TosaToLinalg/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToLinalg",
    ],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LinalgDialect",
        ":MathDialect",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TensorUtils",
        ":TosaDialect",
        ":Transforms",
    ],
)

cc_library(
    name = "TosaToSCF",
    srcs = glob([
        "lib/Conversion/TosaToSCF/*.cpp",
        "lib/Conversion/TosaToSCF/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TosaToSCF/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToSCF",
    ],
    deps = [
        ":ConversionPassIncGen",
        ":IR",
        ":Pass",
        ":SCFDialect",
        ":TensorDialect",
        ":TosaDialect",
        ":Transforms",
    ],
)

cc_library(
    name = "TosaToTensor",
    srcs = glob([
        "lib/Conversion/TosaToTensor/*.cpp",
        "lib/Conversion/TosaToTensor/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/TosaToTensor/*.h",
    ]),
    includes = [
        "include",
        "lib/Conversion/TosaToTensor",
    ],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":TensorDialect",
        ":TosaDialect",
        ":Transforms",
    ],
)

td_library(
    name = "TransformDialectTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/IR/*.td"]),
    deps = [
        ":ControlFlowInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":PDLDialectTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDialectInterfacesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-op-interface-decls",
            ],
            "include/mlir/Dialect/Transform/IR/TransformInterfaces.h.inc",
        ),
        (
            [
                "-gen-op-interface-defs",
            ],
            "include/mlir/Dialect/Transform/IR/TransformInterfaces.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformInterfaces.td",
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "TransformDialectIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
            ],
            "include/mlir/Dialect/Transform/IR/TransformDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformDialect.td",
    deps = [":TransformDialectTdFiles"],
)

gentbl_cc_library(
    name = "TransformOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Transform/IR/TransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Transform/IR/TransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/IR/TransformOps.td",
    deps = [":TransformDialectTdFiles"],
)

cc_library(
    name = "TransformDialect",
    srcs = glob(["lib/Dialect/Transform/IR/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/IR/*.h"]),
    deps = [
        ":ControlFlowInterfaces",
        ":IR",
        ":PDLDialect",
        ":PDLInterpDialect",
        ":Rewrite",
        ":SideEffectInterfaces",
        ":Support",
        ":TransformDialectIncGen",
        ":TransformDialectInterfacesIncGen",
        ":TransformOpsIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "TransformDialectTransformsTdFiles",
    srcs = glob(["include/mlir/Dialect/Transform/Transforms/*.td"]),
    deps = [
        ":PassBaseTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "TransformDialectTransformsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Transform",
            ],
            "include/mlir/Dialect/Transform/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Transform/Transforms/Passes.td",
    deps = [":TransformDialectTransformsTdFiles"],
)

cc_library(
    name = "TransformDialectTransforms",
    srcs = glob(["lib/Dialect/Transform/Transforms/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/Transform/Transforms/*.h"]),
    deps = [
        ":Analysis",
        ":IR",
        ":Pass",
        ":SideEffectInterfaces",
        ":TransformDialect",
        ":TransformDialectTransformsIncGen",
        "//llvm:Support",
    ],
)

td_library(
    name = "ComplexOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Complex/IR/ComplexBase.td",
        "include/mlir/Dialect/Complex/IR/ComplexOps.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ComplexBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=complex",
            ],
            "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=complex",
            ],
            "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Complex/IR/ComplexBase.td",
    deps = [":ComplexOpsTdFiles"],
)

gentbl_cc_library(
    name = "ComplexOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Complex/IR/ComplexOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Complex/IR/ComplexOps.td",
    deps = [":ComplexOpsTdFiles"],
)

cc_library(
    name = "ComplexDialect",
    srcs = glob(
        [
            "lib/Dialect/Complex/IR/*.cpp",
            "lib/Dialect/Complex/IR/*.h",
        ],
    ),
    hdrs = ["include/mlir/Dialect/Complex/IR/Complex.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ComplexBaseIncGen",
        ":ComplexOpsIncGen",
        ":IR",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ComplexToLLVM",
    srcs = glob([
        "lib/Conversion/ComplexToLLVM/*.cpp",
        "lib/Conversion/ComplexToLLVM/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/ComplexToLLVM/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":LLVMCommonConversion",
        ":LLVMDialect",
        ":Pass",
        ":Support",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ComplexToLibm",
    srcs = glob([
        "lib/Conversion/ComplexToLibm/*.cpp",
        "lib/Conversion/ComplexToLibm/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/ComplexToLibm/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":Pass",
        ":Support",
        ":Transforms",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ComplexToStandard",
    srcs = glob([
        "lib/Conversion/ComplexToStandard/*.cpp",
        "lib/Conversion/ComplexToStandard/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/ComplexToStandard/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ComplexDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MathDialect",
        ":Pass",
        ":Transforms",
    ],
)

exports_files([
    "include/mlir/Interfaces/CallInterfaces.h",
    "include/mlir/Interfaces/CastInterfaces.h",
    "include/mlir/Interfaces/ControlFlowInterfaces.h",
    "include/mlir/Transforms/InliningUtils.h",
])

td_library(
    name = "ArithmeticOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td",
        "include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td",
    ],
    includes = ["include"],
    deps = [
        ":CastInterfacesTdFiles",
        ":InferIntRangeInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArithmeticBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=arith",
            ],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=arith",
            ],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOpsDialect.cpp.inc",
        ),
        (
            ["-gen-enum-decls"],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOpsEnums.h.inc",
        ),
        (
            ["-gen-enum-defs"],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOpsEnums.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td",
    deps = [":ArithmeticOpsTdFiles"],
)

gentbl_cc_library(
    name = "ArithmeticOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.td",
    deps = [
        ":ArithmeticOpsTdFiles",
    ],
)

gentbl_cc_library(
    name = "ArithmeticCanonicalizationIncGen",
    strip_include_prefix = "include/mlir/Dialect/Arithmetic/IR",
    tbl_outs = [
        (
            ["-gen-rewriters"],
            "include/mlir/Dialect/Arithmetic/IR/ArithmeticCanonicalization.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "lib/Dialect/Arithmetic/IR/ArithmeticCanonicalization.td",
    deps = [
        ":ArithmeticOpsTdFiles",
        ":CastInterfacesTdFiles",
        ":FuncTdFiles",
    ],
)

cc_library(
    name = "ArithmeticDialect",
    srcs = glob(
        [
            "lib/Dialect/Arithmetic/IR/*.cpp",
            "lib/Dialect/Arithmetic/IR/*.h",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Arithmetic/IR/Arithmetic.h",
        "include/mlir/Transforms/InliningUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticBaseIncGen",
        ":ArithmeticCanonicalizationIncGen",
        ":ArithmeticOpsIncGen",
        ":CommonFolders",
        ":DialectUtils",
        ":IR",
        ":InferIntRangeInterface",
        ":InferTypeOpInterface",
        ":SideEffectInterfaces",
        ":VectorInterfaces",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ArithmeticPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Arithmetic",
            ],
            "include/mlir/Dialect/Arithmetic/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Arithmetic/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "ArithmeticTransforms",
    srcs = glob([
        "lib/Dialect/Arithmetic/Transforms/*.cpp",
        "lib/Dialect/Arithmetic/Transforms/*.h",
    ]),
    hdrs = [
        "include/mlir/Dialect/Arithmetic/Transforms/BufferizableOpInterfaceImpl.h",
        "include/mlir/Dialect/Arithmetic/Transforms/Passes.h",
    ],
    includes = ["include"],
    deps = [
        ":Analysis",
        ":ArithmeticDialect",
        ":ArithmeticPassIncGen",
        ":ArithmeticUtils",
        ":BufferizationDialect",
        ":BufferizationTransforms",
        ":FuncDialect",
        ":IR",
        ":InferIntRangeInterface",
        ":MemRefDialect",
        ":Pass",
        ":TransformUtils",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "ArithmeticUtils",
    srcs = glob([
        "lib/Dialect/Arithmetic/Utils/*.cpp",
    ]),
    hdrs = ["include/mlir/Dialect/Arithmetic/Utils/Utils.h"],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":IR",
        "//llvm:Support",
    ],
)

td_library(
    name = "MathOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Math/IR/MathBase.td",
        "include/mlir/Dialect/Math/IR/MathOps.td",
    ],
    includes = ["include"],
    deps = [
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":VectorInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "MathBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=math",
            ],
            "include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=math",
            ],
            "include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Math/IR/MathBase.td",
    deps = [":MathOpsTdFiles"],
)

gentbl_cc_library(
    name = "MathOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Math/IR/MathOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Math/IR/MathOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Math/IR/MathOps.td",
    deps = [":MathOpsTdFiles"],
)

cc_library(
    name = "MathDialect",
    srcs = glob(
        [
            "lib/Dialect/Math/IR/*.cpp",
            "lib/Dialect/Math/IR/*.h",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/Math/IR/Math.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":CommonFolders",
        ":IR",
        ":InferTypeOpInterface",
        ":MathBaseIncGen",
        ":MathOpsIncGen",
        ":SideEffectInterfaces",
        ":VectorInterfaces",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathTransforms",
    srcs = glob([
        "lib/Dialect/Math/Transforms/*.cpp",
        "lib/Dialect/Math/Transforms/*.h",
    ]),
    hdrs = glob(["include/mlir/Dialect/Math/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":MathDialect",
        ":SCFDialect",
        ":Transforms",
        ":VectorDialect",
        ":VectorUtils",
        ":X86VectorDialect",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MathToLibm",
    srcs = glob([
        "lib/Conversion/MathToLibm/*.cpp",
        "lib/Conversion/MathToLibm/*.h",
    ]) + [":ConversionPassDetail"],
    hdrs = glob([
        "include/mlir/Conversion/MathToLibm/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ConversionPassIncGen",
        ":DialectUtils",
        ":FuncDialect",
        ":IR",
        ":LLVMDialect",
        ":MathDialect",
        ":Pass",
        ":Support",
        ":Transforms",
        ":VectorDialect",
        ":VectorUtils",
        "//llvm:Core",
        "//llvm:Support",
    ],
)

td_library(
    name = "MemRefOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/MemRef/IR/MemRefBase.td",
        "include/mlir/Dialect/MemRef/IR/MemRefOps.td",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticOpsTdFiles",
        ":CastInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":CopyOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
        ":ViewLikeInterfaceTdFiles",
    ],
)

gentbl_cc_library(
    name = "MemRefBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=memref",
            ],
            "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=memref",
            ],
            "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/IR/MemRefBase.td",
    deps = [":MemRefOpsTdFiles"],
)

gentbl_cc_library(
    name = "MemRefOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/IR/MemRefOps.td",
    deps = [":MemRefOpsTdFiles"],
)

cc_library(
    name = "MemRefDialect",
    srcs = glob(
        [
            "lib/Dialect/MemRef/IR/*.cpp",
            "lib/Dialect/MemRef/IR/*.h",
            "lib/Dialect/MemRef/Utils/*.cpp",
        ],
    ),
    hdrs = [
        "include/mlir/Dialect/MemRef/IR/MemRef.h",
        "include/mlir/Dialect/MemRef/Utils/MemRefUtils.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":ArithmeticUtils",
        ":ControlFlowInterfaces",
        ":CopyOpInterface",
        ":DialectUtils",
        ":IR",
        ":InferTypeOpInterface",
        ":MemRefBaseIncGen",
        ":MemRefOpsIncGen",
        ":ViewLikeInterface",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "MemRefPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=MemRef",
            ],
            "include/mlir/Dialect/MemRef/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MemRef/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "MemRefTransforms",
    srcs = glob(
        [
            "lib/Dialect/MemRef/Transforms/*.cpp",
            "lib/Dialect/MemRef/Transforms/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/MemRef/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AffineUtils",
        ":ArithmeticDialect",
        ":ArithmeticTransforms",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":MemRefPassIncGen",
        ":Pass",
        ":TensorDialect",
        ":Transforms",
        ":VectorDialect",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# MLProgram dialect
##---------------------------------------------------------------------------##

td_library(
    name = "MLProgramOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramBase.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td",
        "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td",
    ],
    includes = ["include"],
    deps = [
        ":CallInterfacesTdFiles",
        ":ControlFlowInterfacesTdFiles",
        ":FunctionInterfacesTdFiles",
        ":OpBaseTdFiles",
        ":RegionKindInterfaceIncGen",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "MLProgramOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc",
        ),
        (
            ["-gen-dialect-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc",
        ),
        (
            ["-gen-dialect-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td",
    deps = [":MLProgramOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLProgramAttributesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-attrdef-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc",
        ),
        (
            ["-gen-attrdef-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td",
    deps = [":MLProgramOpsTdFiles"],
)

gentbl_cc_library(
    name = "MLProgramTypesIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-typedef-decls"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc",
        ),
        (
            ["-gen-typedef-defs"],
            "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td",
    deps = [":MLProgramOpsTdFiles"],
)

cc_library(
    name = "MLProgramDialect",
    srcs = glob([
        "lib/Dialect/MLProgram/IR/*.cpp",
        "lib/Dialect/MLProgram/IR/*.h",
    ]),
    hdrs = glob([
        "include/mlir/Dialect/MLProgram/IR/*.h",
    ]),
    includes = ["include"],
    deps = [
        ":ControlFlowInterfaces",
        ":IR",
        ":MLProgramAttributesIncGen",
        ":MLProgramOpsIncGen",
        ":MLProgramTypesIncGen",
        ":Pass",
        ":Support",
        "//llvm:Support",
    ],
)

##---------------------------------------------------------------------------##
# Allocation interfaces
##---------------------------------------------------------------------------##

td_library(
    name = "AllocationOpInterfaceTdFiles",
    srcs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td"],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "AllocationOpInterfaceIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-interface-decls"],
            "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc",
        ),
        (
            ["-gen-op-interface-defs"],
            "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td",
    deps = [":AllocationOpInterfaceTdFiles"],
)

cc_library(
    name = "AllocationOpInterface",
    srcs = ["lib/Dialect/Bufferization/IR/AllocationOpInterface.cpp"],
    hdrs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"],
    includes = ["include"],
    deps = [
        ":AllocationOpInterfaceIncGen",
        ":IR",
    ],
)

td_library(
    name = "BufferizationOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td",
        "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td",
    ],
    includes = ["include"],
    deps = [
        ":AllocationOpInterfaceTdFiles",
        ":CopyOpInterfaceTdFiles",
        ":InferTypeOpInterfaceTdFiles",
        ":OpBaseTdFiles",
        ":SideEffectInterfacesTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizationBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=bufferization",
            ],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=bufferization",
            ],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td",
    deps = [":BufferizationOpsTdFiles"],
)

td_library(
    name = "BufferizationTransformOpsTdFiles",
    srcs = [
        "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td",
    ],
    includes = ["include"],
    deps = [
        ":PDLDialectTdFiles",
        ":TransformDialectTdFiles",
    ],
)

gentbl_cc_library(
    name = "BufferizationTransformOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td",
    deps = [
        ":BufferizationTransformOpsTdFiles",
    ],
)

cc_library(
    name = "BufferizationTransformOps",
    srcs = [
        "lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h",
    ],
    includes = ["include"],
    deps = [
        ":BufferizationDialect",
        ":BufferizationTransformOpsIncGen",
        ":BufferizationTransforms",
        ":IR",
        ":MemRefDialect",
        ":PDLDialect",
        ":Parser",
        ":SideEffectInterfaces",
        ":TransformDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "BufferizationOpsIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            ["-gen-op-decls"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc",
        ),
        (
            ["-gen-op-defs"],
            "include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td",
    deps = [
        ":BufferizableOpInterfaceTdFiles",
        ":BufferizationOpsTdFiles",
    ],
)

cc_library(
    name = "BufferizationDialect",
    srcs = [
        "lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp",
        "lib/Dialect/Bufferization/IR/BufferizationDialect.cpp",
        "lib/Dialect/Bufferization/IR/BufferizationOps.cpp",
    ],
    hdrs = [
        "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h",
        "include/mlir/Dialect/Bufferization/IR/Bufferization.h",
    ],
    includes = ["include"],
    deps = [
        ":AffineDialect",
        ":AllocationOpInterface",
        ":ArithmeticDialect",
        ":BufferizableOpInterfaceIncGen",
        ":BufferizationBaseIncGen",
        ":BufferizationOpsIncGen",
        ":CopyOpInterface",
        ":FuncDialect",
        ":IR",
        ":InferTypeOpInterface",
        ":MemRefDialect",
        ":SparseTensorDialect",
        ":Support",
        ":TensorDialect",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "BufferizationPassIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Bufferization",
            ],
            "include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/Bufferization/Transforms/Passes.td",
    deps = [":PassBaseTdFiles"],
)

cc_library(
    name = "BufferizationTransforms",
    srcs = glob(
        [
            "lib/Dialect/Bufferization/Transforms/*.cpp",
            "lib/Dialect/Bufferization/Transforms/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Dialect/Bufferization/Transforms/*.h"]),
    includes = ["include"],
    deps = [
        ":AllocationOpInterface",
        ":Analysis",
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":BufferizationPassIncGen",
        ":ControlFlowInterfaces",
        ":FuncDialect",
        ":IR",
        ":LoopLikeInterface",
        ":MemRefDialect",
        ":Pass",
        ":TensorDialect",
        ":Transforms",
        "//llvm:Support",
    ],
)

cc_library(
    name = "BufferizationToMemRef",
    srcs = [
        "lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp",
        ":ConversionPassDetail",
    ],
    hdrs = [
        "include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h",
    ],
    includes = ["include"],
    deps = [
        ":ArithmeticDialect",
        ":BufferizationDialect",
        ":ConversionPassIncGen",
        ":FuncDialect",
        ":IR",
        ":MemRefDialect",
        ":Pass",
        ":Support",
        ":Transforms",
    ],
)

td_library(
    name = "DLTIDialectTdFiles",
    srcs = [
        "include/mlir/Dialect/DLTI/DLTI.td",
        "include/mlir/Dialect/DLTI/DLTIBase.td",
    ],
    includes = ["include"],
    deps = [":OpBaseTdFiles"],
)

gentbl_cc_library(
    name = "DLTIBaseIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-dialect-decls",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIDialect.h.inc",
        ),
        (
            [
                "-gen-dialect-defs",
                "-dialect=dlti",
            ],
            "include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Dialect/DLTI/DLTIBase.td",
    deps = [":OpBaseTdFiles"],
)

cc_library(
    name = "DLTIDialect",
    srcs = glob(["lib/Dialect/DLTI/*.cpp"]),
    hdrs = glob(["include/mlir/Dialect/DLTI/*.h"]),
    includes = ["include"],
    deps = [
        ":DLTIBaseIncGen",
        ":DataLayoutInterfaces",
        ":IR",
        "//llvm:Support",
    ],
)

gentbl_cc_library(
    name = "ReducerIncGen",
    strip_include_prefix = "include",
    tbl_outs = [
        (
            [
                "-gen-pass-decls",
                "-name=Reducer",
            ],
            "include/mlir/Reducer/Passes.h.inc",
        ),
    ],
    tblgen = ":mlir-tblgen",
    td_file = "include/mlir/Reducer/Passes.td",
    deps = [
        ":PassBaseTdFiles",
        ":ReducerTdFiles",
    ],
)

cc_library(
    name = "Reducer",
    srcs = glob(["lib/Reducer/*.cpp"]),
    hdrs = glob(["include/mlir/Reducer/*.h"]),
    includes = ["include"],
    deps = [
        ":IR",
        ":Pass",
        ":ReducerIncGen",
        ":Rewrite",
        ":Support",
        ":TransformUtils",
        "//llvm:Support",
    ],
)

cc_library(
    name = "MlirReduceLib",
    srcs = ["lib/Tools/mlir-reduce/MlirReduceMain.cpp"],
    hdrs = ["include/mlir/Tools/mlir-reduce/MlirReduceMain.h"],
    includes = ["include"],
    deps = [
        ":IR",
        ":Parser",
        ":Pass",
        ":Reducer",
        ":Rewrite",
        ":Support",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "mlir-reduce",
    srcs = ["tools/mlir-reduce/mlir-reduce.cpp"],
    includes = ["include"],
    local_defines = ["MLIR_INCLUDE_TESTS"],
    stamp = 0,
    deps = [
        ":AllPassesAndDialects",
        ":IR",
        ":MlirReduceLib",
        "//llvm:Support",
        "//mlir/test:TestDialect",
    ],
)

cc_library(
    name = "PDLLODS",
    srcs = glob(
        [
            "lib/Tools/PDLL/ODS/*.cpp",
            "lib/Tools/PDLL/ODS/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/ODS/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLAST",
    srcs = glob(
        [
            "lib/Tools/PDLL/AST/*.cpp",
            "lib/Tools/PDLL/AST/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/AST/*.h"]),
    includes = ["include"],
    deps = [
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLCodeGen",
    srcs = glob(
        [
            "lib/Tools/PDLL/CodeGen/*.cpp",
            "lib/Tools/PDLL/CodeGen/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/CodeGen/*.h"]),
    includes = ["include"],
    deps = [
        ":AsmParser",
        ":IR",
        ":PDLDialect",
        ":PDLLAST",
        ":PDLLODS",
        ":Support",
        "//llvm:Support",
    ],
)

cc_library(
    name = "PDLLParser",
    srcs = glob(
        [
            "lib/Tools/PDLL/Parser/*.cpp",
            "lib/Tools/PDLL/Parser/*.h",
        ],
    ),
    hdrs = glob(["include/mlir/Tools/PDLL/Parser/*.h"]),
    includes = ["include"],
    deps = [
        ":PDLLAST",
        ":PDLLODS",
        ":Support",
        ":TableGen",
        "//llvm:Support",
        "//llvm:TableGen",
    ],
)

cc_binary(
    name = "mlir-pdll",
    srcs = [
        "tools/mlir-pdll/mlir-pdll.cpp",
    ],
    deps = [
        ":IR",
        ":PDLLAST",
        ":PDLLCodeGen",
        ":PDLLODS",
        ":PDLLParser",
        ":Support",
        "//llvm:Support",
        "//llvm:config",
    ],
)

cc_binary(
    name = "mlir-pdll-lsp-server",
    srcs = ["tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp"],
    includes = ["include"],
    deps = [
        ":MlirPdllLspServerLib",
        ":Support",
    ],
)
